v0

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2021 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FlagGenFilePath = "genfile"
	FlagPassPhrase  = "passphrase"
)
View Source
const (
	//
	RouterKey   = "htdfservice"
	TxSizeLimit = 1200000 // tx size is limited to 1200000(bytes)
)
View Source
const MetricsSubsystem = "v0"

Variables

This section is empty.

Functions

func CollectStdTxs

func CollectStdTxs(cdc *codec.Codec, moniker string, genTxsDir string, genDoc tmtypes.GenesisDoc) (
	appGenTxs []auth.StdTx, persistentPeers string, err error)

CollectStdTxs processes and validates application's genesis StdTxs and returns the list of appGenTxs, and persistent peers required to generate genesis.json.

func CollectStdTxsEx

func CollectStdTxsEx(cdc *codec.Codec, moniker string, genTxsDir string, genDoc tmtypes.GenesisDoc) (
	appGenTxs []auth.StdTx, persistentPeers string, err error)

added by junying, 2019-09-11 copied from usdp, junying-todo-20190517 remove persistentPeers

func HtdfAppGenStateJSON added in v0.3.0

func HtdfAppGenStateJSON(cdc *codec.Codec, genDoc tmtypes.GenesisDoc, appGenTxs []json.RawMessage) (
	appState json.RawMessage, err error)

HtdfAppGenState but with JSON

func HtdfValidateGenesisState added in v0.3.0

func HtdfValidateGenesisState(genesisState GenesisState) (err error)

HtdfValidateGenesisState ensures that the genesis state obeys the expected invariants TODO: No validators are both bonded and jailed (#2088) TODO: Error if there is a duplicate validator (#1708) TODO: Ensure all state machine parameters are in genesis (#1704)

func MakeLatestCodec

func MakeLatestCodec() *codec.Codec

Types

type GenesisAccount

type GenesisAccount struct {
	Address       sdk.AccAddress `json:"address"`
	Coins         sdk.Coins      `json:"coins"`
	Sequence      uint64         `json:"sequence_number"`
	AccountNumber uint64         `json:"account_number"`

	// vesting account fields
	OriginalVesting  sdk.Coins `json:"original_vesting"`  // total vesting coins upon initialization
	DelegatedFree    sdk.Coins `json:"delegated_free"`    // delegated vested coins at time of delegation
	DelegatedVesting sdk.Coins `json:"delegated_vesting"` // delegated vesting coins at time of delegation
	StartTime        int64     `json:"start_time"`        // vesting start time (UNIX Epoch time)
	EndTime          int64     `json:"end_time"`          // vesting end time (UNIX Epoch time)
}

GenesisAccount doesn't need pubkey or sequence

func NewGenesisAccount

func NewGenesisAccount(acc *auth.BaseAccount) GenesisAccount

func NewGenesisAccountI

func NewGenesisAccountI(acc auth.Account) GenesisAccount

func (*GenesisAccount) ToAccount

func (ga *GenesisAccount) ToAccount() (acc *auth.BaseAccount)

convert GenesisAccount to auth.BaseAccount

type GenesisFileAccount

type GenesisFileAccount struct {
	Address       sdk.AccAddress `json:"address"`
	Coins         []string       `json:"coins"`
	Sequence      uint64         `json:"sequence_number"`
	AccountNumber uint64         `json:"account_number"`
}

func NewGenesisFileAccount

func NewGenesisFileAccount(acc *auth.BaseAccount) GenesisFileAccount

type GenesisFileState

type GenesisFileState struct {
	Accounts     []GenesisFileAccount  `json:"accounts"`
	AuthData     auth.GenesisState     `json:"auth"`
	StakeData    stake.GenesisState    `json:"stake"`
	MintData     mint.GenesisState     `json:"mint"`
	DistrData    distr.GenesisState    `json:"distr"`
	GovData      gov.GenesisState      `json:"gov"`
	UpgradeData  upgrade.GenesisState  `json:"upgrade"`
	CrisisData   crisis.GenesisState   `json:"cirsis"`
	SlashingData slashing.GenesisState `json:"slashing"`
	ServiceData  service.GenesisState  `json:"service"`
	GuardianData guardian.GenesisState `json:"guardian"`
	GenTxs       []json.RawMessage     `json:"gentxs"`
}

func NewDefaultGenesisFileState

func NewDefaultGenesisFileState() GenesisFileState

NewDefaultGenesisState generates the default state for htdf.

func NewGenesisFileState

func NewGenesisFileState(accounts []GenesisFileAccount, authData auth.GenesisState, stakeData stake.GenesisState, mintData mint.GenesisState,
	distrData distr.GenesisState, govData gov.GenesisState, upgradeData upgrade.GenesisState, serviceData service.GenesisState,
	guardianData guardian.GenesisState, slashingData slashing.GenesisState, crisisData crisis.GenesisState) GenesisFileState

type GenesisState

type GenesisState struct {
	Accounts     []GenesisAccount      `json:"accounts"`
	AuthData     auth.GenesisState     `json:"auth"`
	StakeData    stake.GenesisState    `json:"staking"`
	MintData     mint.GenesisState     `json:"mint"`
	DistrData    distr.GenesisState    `json:"distr"`
	GovData      gov.GenesisState      `json:"gov"`
	UpgradeData  upgrade.GenesisState  `json:"upgrade"`
	CrisisData   crisis.GenesisState   `json:"crisis"`
	SlashingData slashing.GenesisState `json:"slashing"`
	ServiceData  service.GenesisState  `json:"service"`
	GuardianData guardian.GenesisState `json:"guardian"`
	GenTxs       []json.RawMessage     `json:"gentxs"`
}

State to Unmarshal

func HtdfAppGenState added in v0.3.0

func HtdfAppGenState(cdc *codec.Codec, genDoc tmtypes.GenesisDoc, appGenTxs []json.RawMessage) (
	genesisState GenesisState, err error)

Create the core parameters for genesis initialization for htdf note that the pubkey input is this machines pubkey

func NewDefaultGenesisState

func NewDefaultGenesisState() GenesisState

func NewGenesisState

func NewGenesisState(accounts []GenesisAccount, authData auth.GenesisState, stakeData stake.GenesisState, mintData mint.GenesisState,
	distrData distr.GenesisState, govData gov.GenesisState, upgradeData upgrade.GenesisState, serviceData service.GenesisState,
	guardianData guardian.GenesisState, slashingData slashing.GenesisState, crisisData crisis.GenesisState) GenesisState

func (GenesisState) Sanitize

func (gs GenesisState) Sanitize()

Sanitize sorts accounts and coin sets.

type Hooks

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

Combined Staking Hooks

func NewHooks

func NewHooks(dh distr.Hooks, sh slashing.Hooks) Hooks

func (Hooks) AfterDelegationModified

func (h Hooks) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)

func (Hooks) AfterValidatorBeginUnbonding

func (h Hooks) AfterValidatorBeginUnbonding(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)

func (Hooks) AfterValidatorBonded

func (h Hooks) AfterValidatorBonded(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)

func (Hooks) AfterValidatorCreated

func (h Hooks) AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress)

nolint

func (Hooks) AfterValidatorRemoved

func (h Hooks) AfterValidatorRemoved(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)

func (Hooks) BeforeDelegationCreated

func (h Hooks) BeforeDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)

func (Hooks) BeforeDelegationRemoved

func (h Hooks) BeforeDelegationRemoved(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)

func (Hooks) BeforeDelegationSharesModified

func (h Hooks) BeforeDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)

func (Hooks) BeforeValidatorModified

func (h Hooks) BeforeValidatorModified(ctx sdk.Context, valAddr sdk.ValAddress)

func (Hooks) BeforeValidatorSlashed

func (h Hooks) BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, fraction sdk.Dec)

type Metrics

type Metrics struct {
	InvariantFailure metrics.Counter
}

func NopMetrics

func NopMetrics() *Metrics

func PrometheusMetrics

func PrometheusMetrics(config *cfg.InstrumentationConfig) *Metrics

PrometheusMetrics returns Metrics build using Prometheus client library.

type ProtocolV0

type ProtocolV0 struct {
	StakeKeeper stake.Keeper
	// contains filtered or unexported fields
}

func NewProtocolV0

func NewProtocolV0(version uint64, log log.Logger, pk sdk.ProtocolKeeper, invCheckPeriod uint, config *cfg.InstrumentationConfig) *ProtocolV0

func (*ProtocolV0) BeginBlocker

application updates every end block

func (*ProtocolV0) EndBlocker

application updates every end block

func (*ProtocolV0) ExportAppStateAndValidators

func (p *ProtocolV0) ExportAppStateAndValidators(ctx sdk.Context, forZeroHeight bool, jailWhiteList []string) (
	appState json.RawMessage, validators []tmtypes.GenesisValidator, err error)

export the state of htdf for a genesis file

func (*ProtocolV0) GetAnteHandler

func (p *ProtocolV0) GetAnteHandler() sdk.AnteHandler

func (*ProtocolV0) GetBeginBlocker

func (p *ProtocolV0) GetBeginBlocker() sdk.BeginBlocker

func (*ProtocolV0) GetCodec

func (p *ProtocolV0) GetCodec() *codec.Codec

verison0 tx codec

func (*ProtocolV0) GetEndBlocker

func (p *ProtocolV0) GetEndBlocker() sdk.EndBlocker

func (*ProtocolV0) GetFeePreprocessHandler

func (p *ProtocolV0) GetFeePreprocessHandler() sdk.FeePreprocessHandler

func (*ProtocolV0) GetFeeRefundHandler

func (p *ProtocolV0) GetFeeRefundHandler() sdk.FeeRefundHandler

func (*ProtocolV0) GetInitChainer

func (p *ProtocolV0) GetInitChainer() sdk.InitChainer1

func (*ProtocolV0) GetKVStoreKeyList

func (p *ProtocolV0) GetKVStoreKeyList() []*sdk.KVStoreKey

configure all Stores

func (*ProtocolV0) GetQueryRouter

func (p *ProtocolV0) GetQueryRouter() protocol.QueryRouter

func (*ProtocolV0) GetRouter

func (p *ProtocolV0) GetRouter() protocol.Router

func (*ProtocolV0) GetVersion

func (p *ProtocolV0) GetVersion() uint64

func (*ProtocolV0) Init

func (p *ProtocolV0) Init()

verison0 don't need the init

func (*ProtocolV0) InitChainer

func (p *ProtocolV0) InitChainer(ctx sdk.Context, DeliverTx sdk.DeliverTx, req abci.RequestInitChain) abci.ResponseInitChain

custom logic for htdf initialization just 0 version need Initchainer

func (*ProtocolV0) InitMetrics

func (p *ProtocolV0) InitMetrics(store sdk.CommitMultiStore)

func (*ProtocolV0) Load

func (p *ProtocolV0) Load()

load the configuration of this Protocol

func (*ProtocolV0) ValidateTx

func (p *ProtocolV0) ValidateTx(ctx sdk.Context, txBytes []byte, msgs []sdk.Msg) sdk.Error

Jump to

Keyboard shortcuts

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