types

package
v1.5.4 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2021 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Base error codes
	CodeOK                CodeType = 0
	CodeInternal          CodeType = 1
	CodeTxDecode          CodeType = 2
	CodeInvalidSequence   CodeType = 3
	CodeUnauthorized      CodeType = 4
	CodeInsufficientFunds CodeType = 5
	CodeUnknownRequest    CodeType = 6
	CodeInvalidAddress    CodeType = 7
	CodeInvalidPubKey     CodeType = 8
	CodeUnknownAddress    CodeType = 9
	CodeInsufficientCoins CodeType = 10
	CodeInvalidCoins      CodeType = 11
	CodeOutOfGas          CodeType = 12
	CodeMemoTooLarge      CodeType = 13
	CodeInsufficientFee   CodeType = 14
	CodeTooManySignatures CodeType = 15

	// CodespaceRoot is a codespace for error codes in this file only.
	// Notice that 0 is an "unset" codespace, which can be overridden with
	// Error.WithDefaultCodespace().
	CodespaceUndefined CodespaceType = ""
	CodespaceRoot      CodespaceType = "sdk"
)

SDK error codes

Variables

This section is empty.

Functions

func DeepCopy

func DeepCopy(dst, src interface{}) error

Types

type AccountMap

type AccountMap struct {
	MapList map[string]*AccountMapItem `json:"map_list"`

	FilePath string `json:"filePath"`
	// contains filtered or unexported fields
}

func AccountMapFromFile

func AccountMapFromFile(AccountMapFile string) (*AccountMap, error)

AccountMapFromJSON reads JSON data from a file and unmarshalls it into a AccountMapList.

func AccountMapFromJSON

func AccountMapFromJSON(jsonBlob []byte) (*AccountMap, error)

AccountMapFromJSON unmarshalls JSON data into a AccountMapList.

func (*AccountMap) Copy

func (am *AccountMap) Copy() *AccountMap

func (*AccountMap) GenAccountMapList

func (am *AccountMap) GenAccountMapList(filePath string) *AccountMap

GenFilePV generates a new validator with randomly generated private key and sets the filePath, but does not call Save().

func (*AccountMap) Save

func (am *AccountMap) Save()

Save persists the FilePV to disk.

type AccountMapItem

type AccountMapItem struct {
	Signer       common.Address
	Beneficiary  common.Address
	BlsKeyString string
}

AccountMapItem connects tm address with eth address and blsPubKey

func (*AccountMapItem) Copy

func (accountMapItem *AccountMapItem) Copy() *AccountMapItem

type CodeType added in v1.5.4

type CodeType uint32

copied from cosmos-sdk/types/errors.go CodeType - ABCI code identifier within codespace

func (CodeType) IsOK added in v1.5.4

func (code CodeType) IsOK() bool

IsOK - is everything okay?

type CodespaceType added in v1.5.4

type CodespaceType string

CodespaceType - codespace identifier

type CurrEpochValData

type CurrEpochValData struct {
	//deepcopy from NextEpochValData each epoch
	PosTable *txfilter.PosTable `json:"pos_table"`

	TotalBalance *big.Int `json:"total_balance"`
	MinorBonus   *big.Int `json:"-"` //all voted validators share this bonus per block.

	SelectCount     int `json:"-"` //select count of each height
	DKGMembersLimit int `json:"-"` //DKG members upper limit for each epoch
}

type CurrentHeightValData

type CurrentHeightValData struct {
	Height int64 `json:"height"`

	Validators map[string]Validator `json:"validators"`

	ProposerAddress string `json:"-"`

	LastVoteInfo []abciTypes.VoteInfo `json:"-"`
}

type EthAccounts

type EthAccounts struct {
	EthAccounts     []string   `json:"ethAccounts"`
	EthBalances     []*big.Int `json:"ethBalances"`
	EthBeneficiarys []string   `json:"ethBeneficiarys"`
}

func EthAccountsFromJSON

func EthAccountsFromJSON(jsonBlob []byte) (*EthAccounts, error)

EthAccountsFromJSON unmarshalls JSON data into a eth accounts.

func GetInitialEthAccountFromFile

func GetInitialEthAccountFromFile(EthAccountsPath string) (*EthAccounts, error)

GetInitialEthAccountFromFile reads JSON data from a file and unmarshalls it into a initial eth accounts.

type HardForkExpectedData

type HardForkExpectedData struct {
	Height int64 // should remember and update it for every block to remember what height we located

	IsHarfForkPassed bool // This flag is used to record whether the hardfork was passed by most of validators

	// This flag is used to record the hard fork version that most of nodes want to upgrade
	// If the statistic process doesn't exist, statisticsVersion = 0 , use const NextHardForkVersion = 2
	StatisticsVersion uint64

	//This variable is used to record the statisticHeight that most of nodes want to upgrade
	//If the statistic process doesn't exist,statisticsHeight = 0 ,use const NextHardForkHeight = 2
	StatisticHeight int64

	//This variable is used to record the block was generated by which version
	BlockVersion uint64
}

no need to be persisted

type MinerRewardStrategy

type MinerRewardStrategy interface {
	Receiver() common.Address
}

MinerRewardStrategy is a mining strategy

type NextEpochValData

type NextEpochValData struct {
	// will be changed by addValidatorTx and removeValidatorTx.
	PosTable *txfilter.PosTable
}

type Proposer

type Proposer struct {
	Receiver string `json:"receiver"`
}

type Strategy

type Strategy struct {
	ValidatorsStrategy

	InitialValidators []abciTypes.ValidatorUpdate

	//initial bond accounts
	AccMapInitial *AccountMap

	//needn't to be persisted
	BlsSelectStrategy bool

	// need persist every height
	CurrentHeightValData CurrentHeightValData

	// need persist when epoch changes
	CurrEpochValData CurrEpochValData

	// need persist when epoch changes or changed this block
	NextEpochValData NextEpochValData

	AuthTable *txfilter.AuthTable

	// add for hard fork
	HFExpectedData HardForkExpectedData
	// contains filtered or unexported fields
}

Strategy encompasses all available strategies

func NewStrategy

func NewStrategy() *Strategy

func (*Strategy) GetUpdatedValidators

func (strategy *Strategy) GetUpdatedValidators(height int64, seed []byte) abciTypes.ResponseEndBlock

func (*Strategy) Receiver

func (strategy *Strategy) Receiver() common.Address

Receiver returns which address should receive the mining reward

func (*Strategy) SetInitialAccountMap

func (strategy *Strategy) SetInitialAccountMap(accountMapList *AccountMap)

func (*Strategy) SetInitialValidators added in v1.5.4

func (strategy *Strategy) SetInitialValidators(validators []abciTypes.ValidatorUpdate)

SetValidators the initial validators

func (*Strategy) SetSigner added in v1.5.4

func (strategy *Strategy) SetSigner(chainId *big.Int)

func (*Strategy) Signer added in v1.5.4

func (strategy *Strategy) Signer() ethTypes.Signer

type Validator

type Validator struct {
	abciTypes.ValidatorUpdate
	Signer common.Address
}

type ValidatorsStrategy

type ValidatorsStrategy interface {
	SetInitialValidators(validators []abciTypes.ValidatorUpdate)
	//CollectTx(tx *ethTypes.Transaction)
	GetUpdatedValidators(height int64, seed []byte) abciTypes.ResponseEndBlock
	Receiver() common.Address
	Signer() ethTypes.Signer
}

ValidatorsStrategy is a validator strategy

Jump to

Keyboard shortcuts

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