Documentation
¶
Index ¶
- Constants
- func DeepCopy(dst, src interface{}) error
- type AccountMap
- type AccountMapItem
- type CodeType
- type CodespaceType
- type CurrEpochValData
- type CurrentHeightValData
- type EthAccounts
- type HardForkExpectedData
- type MinerRewardStrategy
- type NextEpochValData
- type Proposer
- type Strategy
- func (strategy *Strategy) GetUpdatedValidators(height int64, seed []byte) abciTypes.ResponseEndBlock
- func (strategy *Strategy) Receiver() common.Address
- func (strategy *Strategy) SetInitialAccountMap(accountMapList *AccountMap)
- func (strategy *Strategy) SetInitialValidators(validators []abciTypes.ValidatorUpdate)
- func (strategy *Strategy) SetSigner(chainId *big.Int)
- func (strategy *Strategy) Signer() ethTypes.Signer
- type Validator
- type ValidatorsStrategy
Constants ¶
const ( // Base error codes CodeOK CodeType = 0 CodeInternal CodeType = 1 CodeTxDecode CodeType = 2 CodeInvalidSequence CodeType = 3 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 ¶
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().
type AccountMapItem ¶
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
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 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 ¶
MinerRewardStrategy is a mining strategy
type NextEpochValData ¶
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) 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
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