Documentation ¶
Index ¶
- Constants
- Variables
- func AddLogWithRes(state StateDB, blockNumber uint64, contractAddr common.Address, ...)
- func AdditionalCycleTime() uint64
- func BlocksWillCreate() uint64
- func CDFAccount() common.Address
- func CDFBalance() *big.Int
- func CalcP(totalWeight float64, sqrtWeight float64) float64
- func CalcPV110(sqrtWeight float64) float64
- func CancelProposal_SupportRate() uint64
- func CancelProposal_VoteRate() uint64
- func CheckDuplicateSignReportReward(fraction int) error
- func CheckEconomicModel(version uint32) error
- func CheckIncreaseIssuanceRatio(increaseIssuanceRatio uint16) error
- func CheckMaxEvidenceAge(age, unStakeFreezeDuration int) error
- func CheckMaxValidators(num int) error
- func CheckMinimumRelease(minimumRelease *big.Int) error
- func CheckOperatingThreshold(threshold *big.Int) error
- func CheckRewardPerChangeInterval(rewardPerChangeInterval uint16) error
- func CheckRewardPerMaxChangeRange(rewardPerMaxChangeRange uint16) error
- func CheckSlashBlocksReward(rewards int) error
- func CheckSlashFractionDuplicateSign(fraction int) error
- func CheckStakeThreshold(threshold *big.Int) error
- func CheckUnDelegateFreezeDuration(UnDelegateFreezeDuration, UnStakeFreezeDuration int) error
- func CheckUnStakeFreezeDuration(duration, maxEvidenceAge, zeroProduceFreezeDuration int) error
- func CheckZeroProduceCumulativeTime(zeroProduceCumulativeTime uint16, zeroProduceNumberThreshold uint16) error
- func CheckZeroProduceFreezeDuration(zeroProduceFreezeDuration uint64, unStakeFreezeDuration uint64) error
- func CheckZeroProduceNumberThreshold(zeroProduceCumulativeTime uint16, zeroProduceNumberThreshold uint16) error
- func ConsensusSize() uint64
- func DuplicateSignReportReward() uint32
- func EcParams130() ([]byte, error)
- func EconomicString() string
- func ElectionDistance() uint64
- func EpochSize() uint64
- func HesitateRatio() uint64
- func IncreaseIssuanceRatio() uint16
- 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() uint64
- func ParamProposal_VoteRate() uint64
- func PlatONFoundationYear() uint32
- func PlatONFundAccount() common.Address
- func PlatONFundBalance() *big.Int
- func ResetEconomicDefaultConfig(newEc *EconomicModel)
- func ResetEconomicExtendConfig(newEc *EconomicModelExtend)
- func ResetEconomicExtendConfigUnDelegateFreezeDuration(UnDelegateFreezeDuration uint64)
- func RestrictingMinimumRelease() *big.Int
- func RewardPerChangeInterval() uint16
- func RewardPerMaxChangeRange() uint16
- 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() uint64
- func TextProposal_VoteRate() uint64
- func TheNumberOfDelegationsReward() uint16
- func UnDelegateFreezeDuration() uint64
- func UnStakeFreezeDuration() uint64
- func VersionProposalVote_DurationSeconds() uint64
- func VersionProposal_SupportRate() uint64
- func ZeroProduceCumulativeTime() uint16
- func ZeroProduceFreezeDuration() uint64
- func ZeroProduceNumberThreshold() uint16
- type EconomicModel
- type EconomicModelExtend
- type Result
- type StateDB
Constants ¶
const ( DefualtRule = iota StakingRule SlashingRule RestrictingRule RewardRule GovernanceRule CollectDeclareVersionRule )
plugin rule key
const ( Zero = 0 Eighty = 80 Hundred = 100 TenThousand = 10000 CeilBlocksReward = 50000 CeilMaxValidators = 10000 FloorMaxConsensusVals = 4 CeilMaxConsensusVals = 43 PositiveInfinity = "+∞" CeilUnStakeFreezeDuration = 168 * 2 CeilMaxEvidenceAge = CeilUnStakeFreezeDuration - 1 // The maximum time range for the cumulative number of zero blocks (No more than 64) MaxZeroProduceCumulativeTime uint16 = 50 RewardPerMaxChangeRangeUpperLimit = 2000 RewardPerMaxChangeRangeLowerLimit = 1 RewardPerChangeIntervalUpperLimit = 28 RewardPerChangeIntervalLowerLimit = 2 IncreaseIssuanceRatioUpperLimit = 2000 IncreaseIssuanceRatioLowerLimit = 0 // When electing consensus nodes, it is used to calculate the P value of the binomial distribution ElectionBase = 30 ElectionBasePIP3 = 43 MainNetECHash = "0x259176769541cdb61bc19806cbf5a3f3489f4829b6b69f804f45f947a0c9c3e9" )
const ( DefaultMainNet = iota // PlatON default main net flag DefaultTestNet // PlatON default test net flag DefaultUnitTestNet // PlatON default unit test )
Variables ¶
var (
// 10 LAT
DelegateLowerLimit, _ = new(big.Int).SetString("10000000000000000000", 10)
// 1W LAT
DelegateUpperLimit, _ = new(big.Int).SetString("10000000000000000000000", 10)
// hard code genesis staking balance
// 15W LAT
GeneStakingAmount, _ = new(big.Int).SetString("150000000000000000000000", 10)
// 10W
StakeLowerLimit, _ = new(big.Int).SetString("100000000000000000000000", 10)
// 1000W LAT
StakeUpperLimit, _ = new(big.Int).SetString("10000000000000000000000000", 10)
FloorMinimumRelease = new(big.Int).Mul(new(big.Int).SetUint64(100), one)
CeilMinimumRelease = new(big.Int).Mul(new(big.Int).SetUint64(10000000), one)
)
var ( AvgPackTimeKey = []byte("AvgPackTimeKey") IncIssuanceNumberKey = []byte("IncIssuanceNumberKey") IncIssuanceTimeKey = []byte("IncIssuanceTimeKey") )
Functions ¶
func AddLogWithRes ¶ added in v0.7.6
func AddLogWithRes(state StateDB, blockNumber uint64, contractAddr common.Address, event, code string, datas ...interface{})
addLog let the result add to event. 参数datas可为空,里面的值不能为空 Log.data字段编码规则: 如果datas为空, rlp([code]), 如果datas不为空,rlp([code,rlp(data1),rlp(data2)...]),
func AdditionalCycleTime ¶
func AdditionalCycleTime() uint64
func BlocksWillCreate ¶
func BlocksWillCreate() uint64
func CDFAccount ¶ added in v0.7.3
func CDFBalance ¶ added in v0.7.3
func CalcP ¶ added in v1.0.0
Calculate the P value of the binomial distribution Parameter: The total weight of the election
func CancelProposal_SupportRate ¶
func CancelProposal_SupportRate() uint64
func CancelProposal_VoteRate ¶
func CancelProposal_VoteRate() uint64
func CheckDuplicateSignReportReward ¶ added in v0.7.4
func CheckEconomicModel ¶
func CheckIncreaseIssuanceRatio ¶ added in v1.0.0
func CheckMaxEvidenceAge ¶ added in v0.7.4
func CheckMaxValidators ¶ added in v0.7.4
func CheckMinimumRelease ¶ added in v1.0.0
func CheckOperatingThreshold ¶ added in v0.7.4
func CheckRewardPerChangeInterval ¶ added in v1.0.0
func CheckRewardPerMaxChangeRange ¶ added in v1.0.0
func CheckSlashBlocksReward ¶ added in v0.7.4
func CheckSlashFractionDuplicateSign ¶ added in v0.7.4
func CheckStakeThreshold ¶ added in v0.7.4
func CheckUnDelegateFreezeDuration ¶ added in v1.3.0
func CheckUnStakeFreezeDuration ¶ added in v0.7.4
func CheckZeroProduceCumulativeTime ¶ added in v1.0.0
func CheckZeroProduceFreezeDuration ¶ added in v1.0.0
func CheckZeroProduceNumberThreshold ¶ added in v1.0.0
func ConsensusSize ¶ added in v1.0.0
func ConsensusSize() uint64
func DuplicateSignReportReward ¶ added in v0.7.3
func DuplicateSignReportReward() uint32
func EcParams130 ¶ added in v1.3.0
func EconomicString ¶
func EconomicString() string
func ElectionDistance ¶
func ElectionDistance() uint64
func HesitateRatio ¶
func HesitateRatio() uint64
func IncreaseIssuanceRatio ¶ added in v1.0.0
func IncreaseIssuanceRatio() uint16
func IsYearEnd ¶ added in v0.7.5
Determine whether the block height belongs to the last block at the end of the year according to the passed blockNumber
func LoadAvgPackTime ¶ added in v0.7.5
gets block average pack time (millisecond) from snapshot db.
func LoadCurrentAvgPackTime ¶ added in v0.7.5
gets block average pack time (millisecond) from snapshot db.
func LoadIncIssuanceNumber ¶ added in v0.7.5
func LoadIncIssuanceTime ¶ added in v0.7.5
func MaxConsensusVals ¶ added in v0.7.4
func MaxConsensusVals() uint64
func MaxEvidenceAge ¶ added in v0.7.4
func MaxEvidenceAge() uint32
func MaxValidators ¶ added in v0.7.4
func MaxValidators() uint64
func OperatingThreshold ¶ added in v0.7.4
func ParamProposalVote_DurationSeconds ¶ added in v0.7.4
func ParamProposalVote_DurationSeconds() uint64
func ParamProposal_SupportRate ¶ added in v0.7.4
func ParamProposal_SupportRate() uint64
func ParamProposal_VoteRate ¶ added in v0.7.4
func ParamProposal_VoteRate() uint64
func PlatONFoundationYear ¶
func PlatONFoundationYear() uint32
func PlatONFundBalance ¶ added in v0.7.3
func ResetEconomicDefaultConfig ¶ added in v0.7.4
func ResetEconomicDefaultConfig(newEc *EconomicModel)
func ResetEconomicExtendConfig ¶ added in v1.3.0
func ResetEconomicExtendConfig(newEc *EconomicModelExtend)
func ResetEconomicExtendConfigUnDelegateFreezeDuration ¶ added in v1.3.0
func ResetEconomicExtendConfigUnDelegateFreezeDuration(UnDelegateFreezeDuration uint64)
func RestrictingMinimumRelease ¶ added in v1.0.0
func RewardPerChangeInterval ¶ added in v1.0.0
func RewardPerChangeInterval() uint16
func RewardPerMaxChangeRange ¶ added in v1.0.0
func RewardPerMaxChangeRange() uint16
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 ¶ added in v0.7.4
func SlashBlocksReward() uint32
func SlashFractionDuplicateSign ¶ added in v0.7.4
func SlashFractionDuplicateSign() uint32
*****
- Slashing config *****
func StorageAvgPackTime ¶ added in v0.7.5
saves block average pack time (millisecond) to snapshot db.
func StorageIncIssuanceNumber ¶ added in v0.7.5
func StorageIncIssuanceNumber(hash common.Hash, snapshotDB snapshotdb.DB, incIssuanceNumber uint64) error
Stored the height of the block that was actually issuance
func StorageIncIssuanceTime ¶ added in v0.7.5
Store the expected time for increase issuance
func TextProposalVote_DurationSeconds ¶ added in v0.7.4
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() uint64
func TextProposal_VoteRate ¶
func TextProposal_VoteRate() uint64
func TheNumberOfDelegationsReward ¶ added in v1.0.0
func TheNumberOfDelegationsReward() uint16
func UnDelegateFreezeDuration ¶ added in v1.3.0
func UnDelegateFreezeDuration() uint64
func UnStakeFreezeDuration ¶ added in v0.7.4
func UnStakeFreezeDuration() uint64
func VersionProposalVote_DurationSeconds ¶ added in v0.7.4
func VersionProposalVote_DurationSeconds() uint64
func VersionProposal_SupportRate ¶
func VersionProposal_SupportRate() uint64
func ZeroProduceCumulativeTime ¶ added in v1.0.0
func ZeroProduceCumulativeTime() uint16
func ZeroProduceFreezeDuration ¶ added in v1.0.0
func ZeroProduceFreezeDuration() uint64
func ZeroProduceNumberThreshold ¶ added in v1.0.0
func ZeroProduceNumberThreshold() uint16
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"` Restricting restrictingConfig `json:"restricting"` InnerAcc innerAccount `json:"innerAcc"` }
total
type EconomicModelExtend ¶ added in v1.3.0
type EconomicModelExtend struct {
Staking stakingConfigExtend `json:"staking"`
}
When the chain is started, if new parameters are added, add them to this structure
func GetEce ¶ added in v1.3.0
func GetEce() *EconomicModelExtend
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 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([]byte, []byte) bool) //ppos add TxHash() common.Hash TxIdx() uint32 IntermediateRoot(deleteEmptyObjects bool) common.Hash }
StateDB is an Plugin database for full state querying.