Documentation
¶
Index ¶
- Constants
- func CheckDoubleSignReportedEvent(event *txresult.TestEventLog, signer module.Address, dsBlockHeight int64, ...) bool
- func CheckElectablePRep(prep *icstate.PRep, expGrade icstate.Grade) bool
- func CheckICXBurnedV2Event(event *txresult.TestEventLog, from module.Address, ...) bool
- func CheckPRepCountConfigSetEvent(event *txresult.TestEventLog, main, sub, extra int64) bool
- func CheckPenalizedPRep(prep *icstate.PRep) bool
- func CheckPenaltyImposedEvent(event *txresult.TestEventLog, owner module.Address, status icstate.Status, ...) bool
- func CheckReceiptSuccess(receipts ...Receipt) bool
- func CheckSlashedEvent(event *txresult.TestEventLog, owner, bonder module.Address, slashed *big.Int) bool
- func CheckSlashingRateSetEvent(event *txresult.TestEventLog, pt icmodule.PenaltyType, rate icmodule.Rate) bool
- func CheckUnjailingPRep(prep *icstate.PRep) bool
- func NewCallContext(wc WorldContext, from module.Address) *callContext
- func NewConsensusInfo(dbase db.Database, vl []module.Validator, voted []bool) module.ConsensusInfo
- func NewConsensusInfoBySim(sim Simulator, nilVoteIndices ...int) module.ConsensusInfo
- func ValidatorIndexOf(vl []module.Validator, address module.Address) int
- type Block
- type Env
- func (env *Env) Governance() module.Address
- func (env *Env) RegisterPReps() ([]Receipt, error)
- func (env *Env) SetBonderLists() ([]Receipt, error)
- func (env *Env) SetBonds(amount *big.Int) ([]Receipt, error)
- func (env *Env) SetDelegations(addrs []module.Address, amount *big.Int) ([]Receipt, error)
- func (env *Env) SetDelegationsAll() error
- func (env *Env) SetRevision(revision module.Revision) ([]Receipt, error)
- func (env *Env) SetStakes(addrs []module.Address, amount *big.Int) ([]Receipt, error)
- func (env *Env) SetStakesAll(amount *big.Int) ([]Receipt, error)
- func (env *Env) Simulator() Simulator
- type Event
- type Receipt
- type RewardFund
- type SimConfig
- type SimConfigOption
- type Simulator
- type Transaction
- type TxType
- type WorldContext
Constants ¶
View Source
const ( Failure = 0 Success = 1 )
Variables ¶
This section is empty.
Functions ¶
func CheckDoubleSignReportedEvent ¶ added in v1.4.0
func CheckElectablePRep ¶ added in v1.4.0
func CheckICXBurnedV2Event ¶ added in v1.4.0
func CheckPRepCountConfigSetEvent ¶ added in v1.4.0
func CheckPRepCountConfigSetEvent(event *txresult.TestEventLog, main, sub, extra int64) bool
func CheckPenalizedPRep ¶ added in v1.4.0
func CheckPenaltyImposedEvent ¶ added in v1.4.0
func CheckPenaltyImposedEvent( event *txresult.TestEventLog, owner module.Address, status icstate.Status, pt icmodule.PenaltyType) bool
func CheckReceiptSuccess ¶ added in v1.4.0
func CheckSlashedEvent ¶ added in v1.4.0
func CheckSlashingRateSetEvent ¶ added in v1.4.0
func CheckSlashingRateSetEvent( event *txresult.TestEventLog, pt icmodule.PenaltyType, rate icmodule.Rate) bool
func CheckUnjailingPRep ¶ added in v1.4.0
func NewCallContext ¶
func NewCallContext(wc WorldContext, from module.Address) *callContext
func NewConsensusInfo ¶ added in v1.4.0
func NewConsensusInfoBySim ¶ added in v1.4.0
func NewConsensusInfoBySim(sim Simulator, nilVoteIndices ...int) module.ConsensusInfo
Types ¶
type Block ¶
type Block interface {
Txs() []Transaction
AddTransaction(tx Transaction)
}
type Env ¶
type Env struct {
// contains filtered or unexported fields
}
func NewEnv ¶
NewEnv initializes environment for extension simulation test Default configuration: 100 preps with 2000 ICX 100 bonders with 10000 ICX 100 users with 10000 ICX
func (*Env) Governance ¶ added in v1.4.0
func (*Env) RegisterPReps ¶
RegisterPReps register all preps in Env
func (*Env) SetBonderLists ¶
func (*Env) SetDelegations ¶
func (*Env) SetDelegationsAll ¶
func (*Env) SetRevision ¶ added in v1.4.0
func (*Env) SetStakesAll ¶
SetStakesAll stakes a given amount of ICX for bonders and users
type Receipt ¶
type Receipt interface {
BlockHeight() int64
Status() int
Error() error
Events() []*txresult.TestEventLog
}
func NewReceipt ¶
func NewReceipt(blockHeight int64, err error, events []*txresult.TestEventLog) Receipt
type RewardFund ¶
type SimConfig ¶ added in v1.4.0
type SimConfig struct {
TermPeriod int64
MainPRepCount int64
SubPRepCount int64
ExtraMainPRepCount int64
Irep int64
Rrep int64
UnbondingPeriodMultiplier int64
UnstakeSlotMax int64
LockMinMultiplier int64
LockMaxMultiplier int64
UnbondingMax int64
ValidationPenaltyCondition int64
DelegationSlotMax int64
ConsistentValidationPenaltyCondition int64
ConsistentValidationPenaltyMask int64
ConsistentValidationPenaltySlashRate icmodule.Rate
NonVotePenaltySlashRate icmodule.Rate
BondRequirement icmodule.Rate
RewardFund
}
func NewSimConfig ¶ added in v1.4.0
func NewSimConfig() *SimConfig
func NewSimConfigWithParams ¶ added in v1.4.0
func NewSimConfigWithParams(params map[SimConfigOption]interface{}) *SimConfig
func (*SimConfig) TotalMainPRepCount ¶ added in v1.4.0
type SimConfigOption ¶ added in v1.4.0
type SimConfigOption int
const ( SCOBondRequirement SimConfigOption = iota SCOTermPeriod SCOValidationFailurePenaltyCondition SCOAccumulatedValidationFailurePenaltyCondition SCOAccumulatedValidationFailurePenaltySlashingRate SCOMissedNetworkProposalVotePenaltySlashingRate SCOMainPReps SCOSubPReps SCOExtraMainPReps )
type Simulator ¶
type Simulator interface {
Database() db.Database
BlockHeight() int64
Revision() module.Revision
GetBalance(from module.Address) *big.Int
TotalBond() *big.Int
TotalStake() *big.Int
TotalSupply() *big.Int
ValidatorList() []module.Validator
ValidatorIndexOf(address module.Address) int
GetStateContext() icmodule.StateContext
TermSnapshot() *icstate.TermSnapshot
PRepCountConfig() icstate.PRepCountConfig
GetPReps(grade icstate.Grade) []*icstate.PRep
GetAccountSnapshot(address module.Address) *icstate.AccountSnapshot
GetPRepTermInJSON() map[string]interface{}
GetMainPRepsInJSON() map[string]interface{}
GetSubPRepsInJSON() map[string]interface{}
GetPRepsInJSON() map[string]interface{}
GetNetworkInfoInJSON() map[string]interface{}
GetPRepStatsInJSON(address module.Address) map[string]interface{}
Go(csi module.ConsensusInfo, blocks int64) error
GoTo(csi module.ConsensusInfo, blockHeight int64) error
GoToTermEnd(csi module.ConsensusInfo) error
GoByBlock(csi module.ConsensusInfo, block Block) ([]Receipt, error)
GoByTransaction(csi module.ConsensusInfo, txs ...Transaction) ([]Receipt, error)
Transfer(from, to module.Address, amount *big.Int) Transaction
GoByTransfer(csi module.ConsensusInfo, from, to module.Address, amount *big.Int) ([]Receipt, error)
SetRevision(from module.Address, revision module.Revision) Transaction
GoBySetRevision(csi module.ConsensusInfo, from module.Address, revision module.Revision) ([]Receipt, error)
GetStakeInJSON(from module.Address) map[string]interface{}
SetStake(from module.Address, amount *big.Int) Transaction
GoBySetStake(csi module.ConsensusInfo, from module.Address, amount *big.Int) ([]Receipt, error)
QueryIScore(address module.Address) *big.Int
ClaimIScore(from module.Address) Transaction
GoByClaimIScore(csi module.ConsensusInfo, from module.Address) ([]Receipt, error)
GetPRepByOwner(owner module.Address) *icstate.PRep
GetPRepByNode(node module.Address) *icstate.PRep
SetPRep(from module.Address, info *icstate.PRepInfo) Transaction
GoBySetPRep(csi module.ConsensusInfo, from module.Address, info *icstate.PRepInfo) ([]Receipt, error)
GetDelegationInJSON(address module.Address) map[string]interface{}
SetDelegation(from module.Address, ds icstate.Delegations) Transaction
GoBySetDelegation(csi module.ConsensusInfo, from module.Address, ds *icstate.Delegations) ([]Receipt, error)
GetBondInJSON(address module.Address) map[string]interface{}
SetBond(from module.Address, bonds icstate.Bonds) Transaction
GoBySetBond(csi module.ConsensusInfo, from module.Address, bonds icstate.Bonds) ([]Receipt, error)
GetBonderListInJSON(address module.Address) map[string]interface{}
GetBonderList(address module.Address) icstate.BonderList
SetBonderList(from module.Address, bl icstate.BonderList) Transaction
GoBySetBonderList(csi module.ConsensusInfo, from module.Address, bl icstate.BonderList) ([]Receipt, error)
RegisterPRep(from module.Address, info *icstate.PRepInfo) Transaction
GoByRegisterPRep(csi module.ConsensusInfo, from module.Address, info *icstate.PRepInfo) ([]Receipt, error)
UnregisterPRep(from module.Address) Transaction
GoByUnregisterPRep(csi module.ConsensusInfo, from module.Address) ([]Receipt, error)
DisqualifyPRep(from, address module.Address) Transaction
GoByDisqualifyPRep(csi module.ConsensusInfo, from, address module.Address) ([]Receipt, error)
// After RevisionIISS4R0
GetSlashingRate(pt icmodule.PenaltyType) (icmodule.Rate, error)
GetSlashingRates() (map[string]interface{}, error)
SetSlashingRates(from module.Address, rates map[string]icmodule.Rate) Transaction
GoBySetSlashingRates(csi module.ConsensusInfo, from module.Address, rates map[string]icmodule.Rate) ([]Receipt, error)
GetMinimumBond() *big.Int
SetMinimumBond(from module.Address, bond *big.Int) Transaction
GoBySetMinimumBond(csi module.ConsensusInfo, from module.Address, bond *big.Int) ([]Receipt, error)
InitCommissionRate(from module.Address, rate, maxRate, maxChangeRate icmodule.Rate) Transaction
GoByInitCommissionRate(csi module.ConsensusInfo, from module.Address, rate, maxRate, maxChangeRate icmodule.Rate) ([]Receipt, error)
SetCommissionRate(from module.Address, rate icmodule.Rate) Transaction
GoBySetCommissionRate(csi module.ConsensusInfo, from module.Address, rate icmodule.Rate) ([]Receipt, error)
HandleDoubleSignReport(from module.Address, dsType string, dsBlockHeight int64, signer module.Address) Transaction
GoByHandleDoubleSignReport(csi module.ConsensusInfo,
from module.Address, dsType string, dsBlockHeight int64, signer module.Address) ([]Receipt, error)
RequestUnjail(from module.Address) Transaction
GoByRequestUnjail(csi module.ConsensusInfo, from module.Address) ([]Receipt, error)
GetPRepCountConfig() (map[string]interface{}, error)
SetPRepCountConfig(from module.Address, counts map[string]int64) Transaction
GoBySetPRepCountConfig(csi module.ConsensusInfo, from module.Address, counts map[string]int64) ([]Receipt, error)
GetRewardFundAllocation2() *icstate.RewardFund
SetRewardFundAllocation2(from module.Address, values map[icstate.RFundKey]icmodule.Rate) Transaction
GoBySetRewardFundAllocation2(
csi module.ConsensusInfo, from module.Address, values map[icstate.RFundKey]icmodule.Rate) ([]Receipt, error)
}
type Transaction ¶
func NewTransaction ¶
func NewTransaction(txType TxType, from module.Address, args ...interface{}) Transaction
type TxType ¶
type TxType int
const ( TypeTransfer TxType = iota TypeSetStake TypeSetDelegation TypeSetBond TypeSetBonderList TypeRegisterPRep TypeUnregisterPRep TypeDisqualifyPRep TypeSetPRep TypeSetRevision TypeClaimIScore TypeSetSlashingRates TypeSetMinimumBond TypeInitCommissionRate TypeSetCommissionRate TypeRequestUnjail TypeHandleDoubleSignReport TypeSetPRepCountConfig TypeSetRewardFundAllocation2 )
type WorldContext ¶
type WorldContext interface {
icmodule.WorldContext
GetExtensionState() state.ExtensionState
BlockTimeStamp() int64
Database() db.Database
GetAccountState(id []byte) state.AccountState
GetSnapshot() state.WorldSnapshot
Reset(snapshot state.WorldSnapshot) error
}
func NewWorldContext ¶
func NewWorldContext( ws state.WorldState, blockHeight int64, revision module.Revision, csi module.ConsensusInfo, stepPrice *big.Int, ) WorldContext
Click to show internal directories.
Click to hide internal directories.