governance

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2018 License: LGPL-3.0 Imports: 21 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	//function name
	INIT_CONFIG          = "initConfig"
	REGISTER_CANDIDATE   = "registerCandidate"
	UNREGISTER_CANDIDATE = "unRegisterCandidate"
	APPROVE_CANDIDATE    = "approveCandidate"
	REJECT_CANDIDATE     = "rejectCandidate"
	BLACK_NODE           = "blackNode"
	WHITE_NODE           = "whiteNode"
	QUIT_NODE            = "quitNode"
	VOTE_FOR_PEER        = "voteForPeer"
	UNVOTE_FOR_PEER      = "unVoteForPeer"
	WITHDRAW             = "withdraw"
	COMMIT_DPOS          = "commitDpos"
	UPDATE_CONFIG        = "updateConfig"
	UPDATE_GLOBAL_PARAM  = "updateGlobalParam"
	UPDATE_SPLIT_CURVE   = "updateSplitCurve"
	CALL_SPLIT           = "callSplit"
	TRANSFER_PENALTY     = "transferPenalty"
	WITHDRAW_ONG         = "withdrawOng"

	//key prefix
	GLOBAL_PARAM    = "globalParam"
	VBFT_CONFIG     = "vbftConfig"
	GOVERNANCE_VIEW = "governanceView"
	CANDIDITE_INDEX = "candidateIndex"
	PEER_POOL       = "peerPool"
	VOTE_INFO_POOL  = "voteInfoPool"
	PEER_INDEX      = "peerIndex"
	BLACK_LIST      = "blackList"
	TOTAL_STAKE     = "totalStake"
	PENALTY_STAKE   = "penaltyStake"
	SPLIT_CURVE     = "splitCurve"

	//global
	PRECISE = 1000000
)

Variables

View Source
var MinCandidateFee = uint64(math.Pow(10, constants.ONG_DECIMALS))

candidate fee must >= 1 ONG

View Source
var Xi = []uint64{}/* 101 elements not displayed */

Functions

func ApproveCandidate

func ApproveCandidate(native *native.NativeService) ([]byte, error)

func BlackNode

func BlackNode(native *native.NativeService) ([]byte, error)

func CallSplit

func CallSplit(native *native.NativeService) ([]byte, error)

func CheckVBFTConfig

func CheckVBFTConfig(configuration *config.VBFTConfig) error

func CommitDpos

func CommitDpos(native *native.NativeService) ([]byte, error)

func GetBytesUint32

func GetBytesUint32(b []byte) (uint32, error)

func GetUint32Bytes

func GetUint32Bytes(num uint32) ([]byte, error)

func GetView

func GetView(native *native.NativeService, contract common.Address) (uint32, error)

func InitConfig

func InitConfig(native *native.NativeService) ([]byte, error)

func InitGovernance

func InitGovernance()

func QuitNode

func QuitNode(native *native.NativeService) ([]byte, error)

func RegisterCandidate

func RegisterCandidate(native *native.NativeService) ([]byte, error)

func RegisterGovernanceContract

func RegisterGovernanceContract(native *native.NativeService)

func RejectCandidate

func RejectCandidate(native *native.NativeService) ([]byte, error)

func TransferPenalty

func TransferPenalty(native *native.NativeService) ([]byte, error)

func UnRegisterCandidate

func UnRegisterCandidate(native *native.NativeService) ([]byte, error)

func UnVoteForPeer

func UnVoteForPeer(native *native.NativeService) ([]byte, error)

func UpdateConfig

func UpdateConfig(native *native.NativeService) ([]byte, error)

func UpdateGlobalParam

func UpdateGlobalParam(native *native.NativeService) ([]byte, error)

func UpdateSplitCurve

func UpdateSplitCurve(native *native.NativeService) ([]byte, error)

func VoteForPeer

func VoteForPeer(native *native.NativeService) ([]byte, error)

func WhiteNode

func WhiteNode(native *native.NativeService) ([]byte, error)

func Withdraw

func Withdraw(native *native.NativeService) ([]byte, error)

func WithdrawOng added in v0.9.2

func WithdrawOng(native *native.NativeService) ([]byte, error)

Types

type ApproveCandidateParam

type ApproveCandidateParam struct {
	PeerPubkey string
}

func (*ApproveCandidateParam) Deserialize

func (this *ApproveCandidateParam) Deserialize(r io.Reader) error

func (*ApproveCandidateParam) Serialize

func (this *ApproveCandidateParam) Serialize(w io.Writer) error

type BlackListItem

type BlackListItem struct {
	PeerPubkey string
	Address    common.Address
	InitPos    uint64
}

func (*BlackListItem) Deserialize

func (this *BlackListItem) Deserialize(r io.Reader) error

func (*BlackListItem) Serialize

func (this *BlackListItem) Serialize(w io.Writer) error

type BlackNodeParam

type BlackNodeParam struct {
	PeerPubkeyList []string
}

func (*BlackNodeParam) Deserialize

func (this *BlackNodeParam) Deserialize(r io.Reader) error

func (*BlackNodeParam) Serialize

func (this *BlackNodeParam) Serialize(w io.Writer) error

type CandidateSplitInfo

type CandidateSplitInfo struct {
	PeerPubkey string
	Address    common.Address
	InitPos    uint64
	Stake      uint64
	S          uint64
}

type Configuration

type Configuration struct {
	N                    uint32
	C                    uint32
	K                    uint32
	L                    uint32
	BlockMsgDelay        uint32
	HashMsgDelay         uint32
	PeerHandshakeTimeout uint32
	MaxBlockChangeView   uint32
}

func (*Configuration) Deserialize

func (this *Configuration) Deserialize(r io.Reader) error

func (*Configuration) Serialize

func (this *Configuration) Serialize(w io.Writer) error

type GlobalParam

type GlobalParam struct {
	CandidateFee uint64 //unit: 10^-9 ong
	MinInitStake uint64
	CandidateNum uint64
	PosLimit     uint64
	A            uint64
	B            uint64
	Yita         uint64
	Penalty      uint64
}

func (*GlobalParam) Deserialize

func (this *GlobalParam) Deserialize(r io.Reader) error

func (*GlobalParam) Serialize

func (this *GlobalParam) Serialize(w io.Writer) error

type GovernanceView

type GovernanceView struct {
	View   uint32
	Height uint32
	TxHash common.Uint256
}

func GetGovernanceView

func GetGovernanceView(native *native.NativeService, contract common.Address) (*GovernanceView, error)

func (*GovernanceView) Deserialize

func (this *GovernanceView) Deserialize(r io.Reader) error

func (*GovernanceView) Serialize

func (this *GovernanceView) Serialize(w io.Writer) error

type PeerPoolItem

type PeerPoolItem struct {
	Index      uint32
	PeerPubkey string
	Address    common.Address
	Status     Status
	InitPos    uint64
	TotalPos   uint64
}

func (*PeerPoolItem) Deserialize

func (this *PeerPoolItem) Deserialize(r io.Reader) error

func (*PeerPoolItem) Serialize

func (this *PeerPoolItem) Serialize(w io.Writer) error

type PeerPoolList

type PeerPoolList struct {
	Peers []*PeerPoolItem
}

type PeerPoolMap

type PeerPoolMap struct {
	PeerPoolMap map[string]*PeerPoolItem
}

func GetPeerPoolMap

func GetPeerPoolMap(native *native.NativeService, contract common.Address, view uint32) (*PeerPoolMap, error)

func (*PeerPoolMap) Deserialize

func (this *PeerPoolMap) Deserialize(r io.Reader) error

func (*PeerPoolMap) Serialize

func (this *PeerPoolMap) Serialize(w io.Writer) error

type PeerStakeInfo

type PeerStakeInfo struct {
	Index      uint32
	PeerPubkey string
	Stake      uint64
}

type PenaltyStake

type PenaltyStake struct {
	PeerPubkey string
	InitPos    uint64
	VotePos    uint64
	TimeOffset uint32
	Amount     uint64
}

func (*PenaltyStake) Deserialize

func (this *PenaltyStake) Deserialize(r io.Reader) error

func (*PenaltyStake) Serialize

func (this *PenaltyStake) Serialize(w io.Writer) error

type QuitNodeParam

type QuitNodeParam struct {
	PeerPubkey string
	Address    common.Address
}

func (*QuitNodeParam) Deserialize

func (this *QuitNodeParam) Deserialize(r io.Reader) error

func (*QuitNodeParam) Serialize

func (this *QuitNodeParam) Serialize(w io.Writer) error

type RegisterCandidateParam

type RegisterCandidateParam struct {
	PeerPubkey string
	Address    common.Address
	InitPos    uint64
	Caller     []byte
	KeyNo      uint64
}

func (*RegisterCandidateParam) Deserialize

func (this *RegisterCandidateParam) Deserialize(r io.Reader) error

func (*RegisterCandidateParam) Serialize

func (this *RegisterCandidateParam) Serialize(w io.Writer) error

type RejectCandidateParam

type RejectCandidateParam struct {
	PeerPubkey string
}

func (*RejectCandidateParam) Deserialize

func (this *RejectCandidateParam) Deserialize(r io.Reader) error

func (*RejectCandidateParam) Serialize

func (this *RejectCandidateParam) Serialize(w io.Writer) error

type SplitCurve

type SplitCurve struct {
	Yi []uint64
}

func (*SplitCurve) Deserialize

func (this *SplitCurve) Deserialize(r io.Reader) error

func (*SplitCurve) Serialize

func (this *SplitCurve) Serialize(w io.Writer) error

type Status

type Status int
const (
	//status
	RegisterCandidateStatus Status = iota
	CandidateStatus
	ConsensusStatus
	QuitConsensusStatus
	QuitingStatus
	BlackStatus
)

func (*Status) Deserialize

func (this *Status) Deserialize(r io.Reader) error

func (*Status) Serialize

func (this *Status) Serialize(w io.Writer) error

type SyncNodeSplitInfo

type SyncNodeSplitInfo struct {
	PeerPubkey string
	Address    common.Address
	InitPos    uint64
	S          uint64
}

type TotalStake

type TotalStake struct {
	Address    common.Address
	Stake      uint64
	TimeOffset uint32
}

func (*TotalStake) Deserialize

func (this *TotalStake) Deserialize(r io.Reader) error

func (*TotalStake) Serialize

func (this *TotalStake) Serialize(w io.Writer) error

type TransferPenaltyParam

type TransferPenaltyParam struct {
	PeerPubkey string
	Address    common.Address
}

func (*TransferPenaltyParam) Deserialize

func (this *TransferPenaltyParam) Deserialize(r io.Reader) error

func (*TransferPenaltyParam) Serialize

func (this *TransferPenaltyParam) Serialize(w io.Writer) error

type UnRegisterCandidateParam

type UnRegisterCandidateParam struct {
	PeerPubkey string
	Address    common.Address
}

func (*UnRegisterCandidateParam) Deserialize

func (this *UnRegisterCandidateParam) Deserialize(r io.Reader) error

func (*UnRegisterCandidateParam) Serialize

func (this *UnRegisterCandidateParam) Serialize(w io.Writer) error

type VoteForPeerParam

type VoteForPeerParam struct {
	Address        common.Address
	PeerPubkeyList []string
	PosList        []uint64
}

func (*VoteForPeerParam) Deserialize

func (this *VoteForPeerParam) Deserialize(r io.Reader) error

func (*VoteForPeerParam) Serialize

func (this *VoteForPeerParam) Serialize(w io.Writer) error

type VoteInfo

type VoteInfo struct {
	PeerPubkey          string
	Address             common.Address
	ConsensusPos        uint64
	FreezePos           uint64
	NewPos              uint64
	WithdrawPos         uint64
	WithdrawFreezePos   uint64
	WithdrawUnfreezePos uint64
}

func (*VoteInfo) Deserialize

func (this *VoteInfo) Deserialize(r io.Reader) error

func (*VoteInfo) Serialize

func (this *VoteInfo) Serialize(w io.Writer) error

type WhiteNodeParam

type WhiteNodeParam struct {
	PeerPubkey string
}

func (*WhiteNodeParam) Deserialize

func (this *WhiteNodeParam) Deserialize(r io.Reader) error

func (*WhiteNodeParam) Serialize

func (this *WhiteNodeParam) Serialize(w io.Writer) error

type WithdrawOngParam added in v0.9.2

type WithdrawOngParam struct {
	Address common.Address
}

func (*WithdrawOngParam) Deserialize added in v0.9.2

func (this *WithdrawOngParam) Deserialize(r io.Reader) error

func (*WithdrawOngParam) Serialize added in v0.9.2

func (this *WithdrawOngParam) Serialize(w io.Writer) error

type WithdrawParam

type WithdrawParam struct {
	Address        common.Address
	PeerPubkeyList []string
	WithdrawList   []uint64
}

func (*WithdrawParam) Deserialize

func (this *WithdrawParam) Deserialize(r io.Reader) error

func (*WithdrawParam) Serialize

func (this *WithdrawParam) Serialize(w io.Writer) error

Jump to

Keyboard shortcuts

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