iiss

package
v1.4.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 28, 2024 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventSlashingRateChanged       = "SlashingRateChanged(str,int)" // before RevisionIISS4R0
	EventSlashingRateSet           = "SlashingRateSet(str,int)"
	EventCommissionRateInitialized = "CommissionRateInitialized(Address,int,int,int)"
	EventCommissionRateSet         = "CommissionRateSet(Address,int)"
	EventPenaltyImposed            = "PenaltyImposed(Address,int,int)"
	EventSlashed                   = "Slashed(Address,Address,int)"
	EventIScoreClaimedV2           = "IScoreClaimedV2(Address,int,int)"
	EventPRepIssued                = "PRepIssued(int,int,int,int)"
	EventICXIssued                 = "ICXIssued(int,int,int,int)"
	EventTermStarted               = "TermStarted(int,int,int)"
	EventPRepRegistered            = "PRepRegistered(Address)"
	EventPRepSet                   = "PRepSet(Address)"
	EventRewardFundTransferred     = "RewardFundTransferred(str,Address,Address,int)"
	EventRewardFundTransferFailed  = "RewardFundTransferFailed(str,Address,Address,int)"
	EventRewardFundBurned          = "RewardFundBurned(str,Address,int)"
	EventPRepUnregistered          = "PRepUnregistered(Address)"
	EventBTPNetworkTypeActivated   = "BTPNetworkTypeActivated(str,int)"
	EventBTPNetworkOpened          = "BTPNetworkOpened(int,int)"
	EventBTPNetworkClosed          = "BTPNetworkClosed(int,int)"
	EventBTPMessage                = "BTPMessage(int,int)"
	EventGovernanceVariablesSet    = "GovernanceVariablesSet(Address,int)"
	EventMinimumBondSet            = "MinimumBondSet(int)"
	EventICXBurnedV2               = "ICXBurnedV2(Address,int,int)"
	EventDoubleSignReported        = "DoubleSignReported(Address,int,str)"
	EventBondSet                   = "BondSet(Address,bytes)"
	EventDelegationSet             = "DelegationSet(Address,bytes)"
	EventPRepCountConfigSet        = "PRepCountConfigSet(int,int,int)"
	EventRewardFundSet             = "RewardFundSet(int)"
	EventRewardFundAllocationSet   = "RewardFundAllocationSet(str,int)"
	EventNetworkScoreSet           = "NetworkScoreSet(str,Address)"
)
View Source
const IrepInflationLimit = 14 // 14%

Variables

This section is empty.

Functions

func CheckBaseTX added in v1.2.9

func CheckBaseTX(tx module.Transaction) bool

func CompileVoters added in v0.9.7

func CompileVoters(state *icstate.State, csi module.ConsensusInfo) ([]module.Address, []module.Address, error)

CompileVoters return slice of owner address of voters It returns slice of owner address of all voters, slice of owner address of voted voters and any error encountered.

func EmitBTPMessageEvent added in v1.4.0

func EmitBTPMessageEvent(cc icmodule.CallContext, nid, sn int64)

func EmitBTPNetworkClosedEvent added in v1.4.0

func EmitBTPNetworkClosedEvent(cc icmodule.CallContext, ntid, nid int64)

func EmitBTPNetworkOpenedEvent added in v1.4.0

func EmitBTPNetworkOpenedEvent(cc icmodule.CallContext, ntid, nid int64)

func EmitBTPNetworkTypeActivatedEvent added in v1.4.0

func EmitBTPNetworkTypeActivatedEvent(cc icmodule.CallContext, networkTypeName string, ntid int64)

func EmitBondSetEvent added in v1.4.0

func EmitBondSetEvent(cc icmodule.CallContext, bonds icstate.Bonds)

func EmitCommissionRateInitializedEvent added in v1.4.0

func EmitCommissionRateInitializedEvent(
	cc icmodule.CallContext, rate, maxRate, maxChangeRate icmodule.Rate)

func EmitCommissionRateSetEvent added in v1.4.0

func EmitCommissionRateSetEvent(
	cc icmodule.CallContext, rate icmodule.Rate)

func EmitDelegationSetEvent added in v1.4.0

func EmitDelegationSetEvent(cc icmodule.CallContext, delegations icstate.Delegations)

func EmitDoubleSignReportedEvent added in v1.4.0

func EmitDoubleSignReportedEvent(cc icmodule.CallContext, signer module.Address, dsBlockHeight int64, dsType string)

func EmitGovernanceVariablesSetEvent added in v1.4.0

func EmitGovernanceVariablesSetEvent(cc icmodule.CallContext, irep *big.Int)

func EmitICXBurnedEvent added in v1.4.0

func EmitICXBurnedEvent(cc icmodule.CallContext, from module.Address, amount, ts *big.Int)

func EmitICXIssuedEvent added in v1.4.0

func EmitICXIssuedEvent(cc icmodule.CallContext, result *IssueResultJSON, issue *icstate.Issue)

func EmitIScoreClaimEvent added in v1.4.0

func EmitIScoreClaimEvent(cc icmodule.CallContext, claim, icx *big.Int)

func EmitMinimumBondSetEvent added in v1.4.0

func EmitMinimumBondSetEvent(cc icmodule.CallContext, bond *big.Int)

func EmitNetworkScoreSetEvent added in v1.4.0

func EmitNetworkScoreSetEvent(cc icmodule.CallContext, role string, address module.Address)

func EmitPRepCountConfigSetEvent added in v1.4.0

func EmitPRepCountConfigSetEvent(cc icmodule.CallContext, main, sub, extra int64)

func EmitPRepIssuedEvent added in v1.4.0

func EmitPRepIssuedEvent(cc icmodule.CallContext, prep *IssuePRepJSON)

func EmitPRepRegisteredEvent added in v1.4.0

func EmitPRepRegisteredEvent(cc icmodule.CallContext)

func EmitPRepSetEvent added in v1.4.0

func EmitPRepSetEvent(cc icmodule.CallContext)

func EmitPRepUnregisteredEvent added in v1.4.0

func EmitPRepUnregisteredEvent(cc icmodule.CallContext)

func EmitPenaltyImposedEvent added in v1.4.0

func EmitPenaltyImposedEvent(cc icmodule.CallContext, ps *icstate.PRepStatusState, pt icmodule.PenaltyType)

func EmitRewardFundAllocationSetEvent added in v1.4.0

func EmitRewardFundAllocationSetEvent(cc icmodule.CallContext, type_ icstate.RFundKey, value icmodule.Rate)

func EmitRewardFundBurnedEvent added in v1.4.0

func EmitRewardFundBurnedEvent(cc icmodule.CallContext, key string, from module.Address, amount *big.Int)

func EmitRewardFundSetEvent added in v1.4.0

func EmitRewardFundSetEvent(cc icmodule.CallContext, value *big.Int)

func EmitRewardFundTransferFailedEvent added in v1.4.2

func EmitRewardFundTransferFailedEvent(cc icmodule.CallContext, key string, from, to module.Address, amount *big.Int)

func EmitRewardFundTransferredEvent added in v1.4.0

func EmitRewardFundTransferredEvent(cc icmodule.CallContext, key string, from, to module.Address, amount *big.Int)

func EmitSlashedEvent added in v1.4.0

func EmitSlashedEvent(cc icmodule.CallContext, owner, bonder module.Address, amount *big.Int)

func EmitSlashingRateSetEvent added in v1.4.0

func EmitSlashingRateSetEvent(cc icmodule.CallContext, penaltyType icmodule.PenaltyType, rate icmodule.Rate)

func EmitTermStartedEvent added in v1.4.0

func EmitTermStartedEvent(cc icmodule.CallContext, sequence int, startHeight, endHeight int64)

func GetIssueData added in v0.9.6

func GetIssueData(es *ExtensionStateImpl) (*IssuePRepJSON, *IssueResultJSON)

GetIssueData return issue information for base TX

func NewCallContext added in v0.9.10

func NewCallContext(cc contract.CallContext, from module.Address) icmodule.CallContext

func NewClaimIScoreLog added in v0.9.10

func NewClaimIScoreLog(from module.Address, amount *big.Int, claim *icstage.IScoreClaim) *claimIScoreLog

func NewExtensionSnapshot added in v0.9.6

func NewExtensionSnapshot(database db.Database, hash []byte) state.ExtensionSnapshot

func NewExtensionSnapshotWithBuilder added in v0.9.6

func NewExtensionSnapshotWithBuilder(builder merkle.Builder, raw []byte) state.ExtensionSnapshot

func NewStateContext added in v1.4.0

func NewWorldContext added in v1.0.0

func NewWorldContext(ctx state.WorldContext, logger log.Logger) icmodule.WorldContext

func RegisterBaseTx

func RegisterBaseTx()

func RegulateIssueInfo added in v0.9.6

func RegulateIssueInfo(issue *icstate.Issue, iScore *big.Int)

RegulateIssueInfo regulate icx issue amount with previous period data.

Types

type Calculator added in v0.9.6

type Calculator interface {
	Stop()
	IsRunningFor(dbase db.Database, back, reward []byte) bool
	WaitResult(blockHeight int64) error
	TotalReward() *big.Int
	Result() *icreward.Snapshot
}

type CalculatorHolder added in v0.9.8

type CalculatorHolder struct {
	// contains filtered or unexported fields
}

func (*CalculatorHolder) Get added in v0.9.8

func (h *CalculatorHolder) Get() Calculator

func (*CalculatorHolder) Start added in v0.9.8

func (h *CalculatorHolder) Start(ess state.ExtensionSnapshot, logger log.Logger)

type Claimed added in v1.0.1

type Claimed struct {
	// contains filtered or unexported fields
}

func (*Claimed) Amount added in v1.0.1

func (c *Claimed) Amount() *big.Int

func (*Claimed) ID added in v1.0.1

func (c *Claimed) ID() []byte

type ExtensionLog added in v0.9.10

type ExtensionLog interface {
	Handle(es *ExtensionStateImpl) error
}

type ExtensionSnapshotImpl added in v0.9.6

type ExtensionSnapshotImpl struct {
	// contains filtered or unexported fields
}

func (*ExtensionSnapshotImpl) Back1 added in v0.9.7

func (*ExtensionSnapshotImpl) Back2 added in v0.9.8

func (*ExtensionSnapshotImpl) Bytes added in v0.9.6

func (s *ExtensionSnapshotImpl) Bytes() []byte

func (*ExtensionSnapshotImpl) DB added in v1.4.0

func (*ExtensionSnapshotImpl) Flush added in v0.9.6

func (s *ExtensionSnapshotImpl) Flush() error

func (*ExtensionSnapshotImpl) NewState added in v0.9.6

func (s *ExtensionSnapshotImpl) NewState(readonly bool) state.ExtensionState

func (*ExtensionSnapshotImpl) RLPDecodeSelf added in v0.9.6

func (s *ExtensionSnapshotImpl) RLPDecodeSelf(d codec.Decoder) error

func (*ExtensionSnapshotImpl) RLPEncodeSelf added in v0.9.6

func (s *ExtensionSnapshotImpl) RLPEncodeSelf(e codec.Encoder) error

func (*ExtensionSnapshotImpl) Reward added in v0.9.7

type ExtensionStateImpl added in v0.9.6

type ExtensionStateImpl struct {
	State  *icstate.State
	Front  *icstage.State
	Back1  *icstage.State
	Back2  *icstage.State
	Reward *icreward.State
	// contains filtered or unexported fields
}

func (*ExtensionStateImpl) AddEventBond added in v0.9.6

func (es *ExtensionStateImpl) AddEventBond(blockHeight int64, from module.Address, delta map[string]*big.Int) (err error)

func (*ExtensionStateImpl) AddEventEnable added in v1.4.0

func (es *ExtensionStateImpl) AddEventEnable(blockHeight int64, owner module.Address, status icmodule.EnableStatus) (err error)

func (*ExtensionStateImpl) AppendExtensionLog added in v0.9.10

func (es *ExtensionStateImpl) AppendExtensionLog(el ExtensionLog)

func (*ExtensionStateImpl) CalculationBlockHeight added in v0.9.6

func (es *ExtensionStateImpl) CalculationBlockHeight() int64

func (*ExtensionStateImpl) ClaimIScore added in v0.9.10

func (es *ExtensionStateImpl) ClaimIScore(cc icmodule.CallContext) error

func (*ExtensionStateImpl) ClearCache added in v0.9.6

func (es *ExtensionStateImpl) ClearCache()

ClearCache clear cache. It's called before executing first transaction and also it could be called at the end of base transaction

func (*ExtensionStateImpl) ClearPRepIllegalDelegated added in v0.9.10

func (es *ExtensionStateImpl) ClearPRepIllegalDelegated() error

func (*ExtensionStateImpl) DisqualifyPRep added in v0.9.6

func (es *ExtensionStateImpl) DisqualifyPRep(cc icmodule.CallContext, address module.Address) error

func (*ExtensionStateImpl) GenesisTerm added in v0.9.6

func (es *ExtensionStateImpl) GenesisTerm(blockHeight int64, revision int) error

func (*ExtensionStateImpl) GetBond added in v1.0.0

func (es *ExtensionStateImpl) GetBond(address module.Address) (map[string]interface{}, error)

func (*ExtensionStateImpl) GetBonderList added in v0.9.6

func (es *ExtensionStateImpl) GetBonderList(address module.Address) (map[string]interface{}, error)

func (*ExtensionStateImpl) GetIScore added in v0.9.10

func (es *ExtensionStateImpl) GetIScore(from module.Address, revision int, txID []byte) (*big.Int, error)

func (*ExtensionStateImpl) GetMainPRepsInJSON added in v0.9.6

func (es *ExtensionStateImpl) GetMainPRepsInJSON(blockHeight int64) (map[string]interface{}, error)

func (*ExtensionStateImpl) GetPRep added in v1.3.0

func (es *ExtensionStateImpl) GetPRep(address module.Address) *icstate.PRep

func (*ExtensionStateImpl) GetPRepCountConfig added in v1.4.0

func (es *ExtensionStateImpl) GetPRepCountConfig() (map[string]interface{}, error)

func (*ExtensionStateImpl) GetPRepInJSON added in v0.9.6

func (es *ExtensionStateImpl) GetPRepInJSON(cc icmodule.CallContext, address module.Address) (map[string]interface{}, error)

func (*ExtensionStateImpl) GetPRepStats added in v1.4.0

func (es *ExtensionStateImpl) GetPRepStats(cc icmodule.CallContext) (map[string]interface{}, error)

func (*ExtensionStateImpl) GetPRepStatsOf added in v1.4.0

func (es *ExtensionStateImpl) GetPRepStatsOf(
	cc icmodule.CallContext, address module.Address) (map[string]interface{}, error)

func (*ExtensionStateImpl) GetPRepTermInJSON added in v0.9.6

func (es *ExtensionStateImpl) GetPRepTermInJSON(cc icmodule.CallContext) (map[string]interface{}, error)

func (*ExtensionStateImpl) GetPRepsInJSON added in v0.9.6

func (es *ExtensionStateImpl) GetPRepsInJSON(cc icmodule.CallContext, start, end int) (map[string]interface{}, error)

func (*ExtensionStateImpl) GetSlashingRates added in v1.4.0

func (es *ExtensionStateImpl) GetSlashingRates(cc icmodule.CallContext) (map[string]interface{}, error)

func (*ExtensionStateImpl) GetSnapshot added in v0.9.6

func (es *ExtensionStateImpl) GetSnapshot() state.ExtensionSnapshot

func (*ExtensionStateImpl) GetSubPRepsInJSON added in v0.9.6

func (es *ExtensionStateImpl) GetSubPRepsInJSON(blockHeight int64) (map[string]interface{}, error)

func (*ExtensionStateImpl) HandleConsensusInfo added in v1.0.2

func (es *ExtensionStateImpl) HandleConsensusInfo(cc icmodule.CallContext) error

func (*ExtensionStateImpl) HandleDoubleSignReport added in v1.4.0

func (es *ExtensionStateImpl) HandleDoubleSignReport(
	cc icmodule.CallContext, dsType string, dsBlockHeight int64, signer module.Address) error

HandleDoubleSignReport handles DoubleSignReport from system signer: Node address of a validator that committed double signing

func (*ExtensionStateImpl) InitCommissionInfo added in v1.4.0

func (es *ExtensionStateImpl) InitCommissionInfo(
	cc icmodule.CallContext, rate, maxRate, maxChangeRate icmodule.Rate) error

func (*ExtensionStateImpl) IsDecentralized added in v0.9.6

func (es *ExtensionStateImpl) IsDecentralized() bool

func (*ExtensionStateImpl) Logger added in v0.9.6

func (es *ExtensionStateImpl) Logger() log.Logger

func (*ExtensionStateImpl) OnBaseTx added in v0.9.8

func (es *ExtensionStateImpl) OnBaseTx(cc icmodule.CallContext, data []byte) error

func (*ExtensionStateImpl) OnExecutionBegin added in v0.9.7

func (es *ExtensionStateImpl) OnExecutionBegin(wc icmodule.WorldContext) error

func (*ExtensionStateImpl) OnExecutionEnd added in v0.9.6

func (es *ExtensionStateImpl) OnExecutionEnd(wc icmodule.WorldContext, totalFee *big.Int, calculator Calculator) error

func (*ExtensionStateImpl) OnOpenBTPNetwork added in v1.3.0

func (es *ExtensionStateImpl) OnOpenBTPNetwork(cc icmodule.CallContext, bc state.BTPContext, ntName string) error

func (*ExtensionStateImpl) OnSetPublicKey added in v1.3.0

func (es *ExtensionStateImpl) OnSetPublicKey(cc icmodule.CallContext, from module.Address, dsaIndex int) error

func (*ExtensionStateImpl) OnTransactionEnd added in v0.9.10

func (es *ExtensionStateImpl) OnTransactionEnd(blockHeight int64, success bool) error

func (*ExtensionStateImpl) PenalizeNonVoters added in v1.1.0

func (es *ExtensionStateImpl) PenalizeNonVoters(cc icmodule.CallContext, address module.Address) error

func (*ExtensionStateImpl) RegisterPRep added in v0.9.6

func (es *ExtensionStateImpl) RegisterPRep(cc icmodule.CallContext, info *icstate.PRepInfo) error

func (*ExtensionStateImpl) RequestUnjail added in v1.4.0

func (es *ExtensionStateImpl) RequestUnjail(cc icmodule.CallContext) error

func (*ExtensionStateImpl) Reset added in v0.9.6

func (es *ExtensionStateImpl) Reset(isnapshot state.ExtensionSnapshot)

func (*ExtensionStateImpl) SetBond added in v0.9.6

func (es *ExtensionStateImpl) SetBond(cc icmodule.CallContext, bonds icstate.Bonds) error

func (*ExtensionStateImpl) SetBonderList added in v0.9.6

func (es *ExtensionStateImpl) SetBonderList(from module.Address, bl icstate.BonderList) error

func (*ExtensionStateImpl) SetCommissionRate added in v1.4.0

func (es *ExtensionStateImpl) SetCommissionRate(cc icmodule.CallContext, rate icmodule.Rate) error

func (*ExtensionStateImpl) SetDelegation added in v0.9.6

func (es *ExtensionStateImpl) SetDelegation(cc icmodule.CallContext, ds icstate.Delegations) error

func (*ExtensionStateImpl) SetGovernanceVariables added in v0.9.6

func (es *ExtensionStateImpl) SetGovernanceVariables(from module.Address, irep *big.Int, blockHeight int64) error

func (*ExtensionStateImpl) SetLogger added in v0.9.6

func (es *ExtensionStateImpl) SetLogger(logger log.Logger)

func (*ExtensionStateImpl) SetMinimumBond added in v1.4.0

func (es *ExtensionStateImpl) SetMinimumBond(cc icmodule.CallContext, nBond *big.Int) error

func (*ExtensionStateImpl) SetPRep added in v0.9.6

func (es *ExtensionStateImpl) SetPRep(cc icmodule.CallContext, info *icstate.PRepInfo, fromBTP bool) error

func (*ExtensionStateImpl) SetPRepCountConfig added in v1.4.0

func (es *ExtensionStateImpl) SetPRepCountConfig(cc icmodule.CallContext, counts map[string]int64) error

func (*ExtensionStateImpl) SetSlashingRates added in v1.4.0

func (es *ExtensionStateImpl) SetSlashingRates(cc icmodule.CallContext, values map[string]icmodule.Rate) error

func (*ExtensionStateImpl) SetStake added in v0.9.10

func (es *ExtensionStateImpl) SetStake(cc icmodule.CallContext, v *big.Int) (err error)

func (*ExtensionStateImpl) UnregisterPRep added in v0.9.6

func (es *ExtensionStateImpl) UnregisterPRep(cc icmodule.CallContext) error

func (*ExtensionStateImpl) ValidateIRep added in v0.9.6

func (es *ExtensionStateImpl) ValidateIRep(oldIRep, newIRep *big.Int, prevSetIRepHeight int64) error

func (*ExtensionStateImpl) ValidateRewardFund added in v1.1.1

func (es *ExtensionStateImpl) ValidateRewardFund(iglobal *big.Int, totalSupply *big.Int, revision int) error

type IssuePRepJSON added in v0.9.6

type IssuePRepJSON struct {
	IRep            *common.HexInt `json:"irep"`
	RRep            *common.HexInt `json:"rrep"`
	TotalDelegation *common.HexInt `json:"totalDelegation"`
	Value           *common.HexInt `json:"value"`
}

func ParseIssuePRepData added in v0.9.7

func ParseIssuePRepData(data []byte) (*IssuePRepJSON, error)

func (*IssuePRepJSON) Equal added in v0.9.7

func (i *IssuePRepJSON) Equal(i2 *IssuePRepJSON) bool

func (*IssuePRepJSON) Format added in v0.9.7

func (i *IssuePRepJSON) Format(f fmt.State, c rune)

func (*IssuePRepJSON) GetIRep added in v0.9.7

func (i *IssuePRepJSON) GetIRep() *big.Int

func (*IssuePRepJSON) GetRRep added in v0.9.7

func (i *IssuePRepJSON) GetRRep() *big.Int

func (*IssuePRepJSON) GetTotalDelegation added in v0.9.7

func (i *IssuePRepJSON) GetTotalDelegation() *big.Int

func (*IssuePRepJSON) GetValue added in v0.9.7

func (i *IssuePRepJSON) GetValue() *big.Int

type IssueResultJSON added in v0.9.6

type IssueResultJSON struct {
	ByFee           *common.HexInt `json:"coveredByFee"`
	ByOverIssuedICX *common.HexInt `json:"coveredByOverIssuedICX"`
	Issue           *common.HexInt `json:"issue"`
}

func ParseIssueResultData added in v0.9.7

func ParseIssueResultData(data []byte) (*IssueResultJSON, error)

func (*IssueResultJSON) Equal added in v0.9.7

func (i *IssueResultJSON) Equal(i2 *IssueResultJSON) bool

func (*IssueResultJSON) Format added in v0.9.7

func (i *IssueResultJSON) Format(f fmt.State, c rune)

func (*IssueResultJSON) GetByFee added in v0.9.7

func (i *IssueResultJSON) GetByFee() *big.Int

func (*IssueResultJSON) GetByOverIssuedICX added in v0.9.7

func (i *IssueResultJSON) GetByOverIssuedICX() *big.Int

func (*IssueResultJSON) GetIssue added in v0.9.7

func (i *IssueResultJSON) GetIssue() *big.Int

func (*IssueResultJSON) GetTotalReward added in v0.9.6

func (i *IssueResultJSON) GetTotalReward() *big.Int

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL