Documentation ¶
Index ¶
- Constants
- func DefaultMessageValidator(msgs []sdk.Msg) error
- func GenesisStateFromAppGenesis(genesis *AppGenesis) (genesisState map[string]json.RawMessage, err error)
- func ParseChainIDFromGenesis(r io.Reader) (string, error)
- func SetGenesisStateInAppState(cdc codec.JSONCodec, appState map[string]json.RawMessage, ...) map[string]json.RawMessage
- func ValidateAndGetGenTx(genTx json.RawMessage, txJSONDecoder sdk.TxDecoder, validator MessageValidator) (sdk.Tx, error)
- func ValidateGenesis(genesisState *GenesisState, txJSONDecoder sdk.TxDecoder, ...) error
- type AccountKeeper
- type AppGenesis
- func AppGenesisFromFile(genFile string) (*AppGenesis, error)
- func AppGenesisFromReader(reader io.Reader) (*AppGenesis, error)
- func GenesisStateFromGenFile(genFile string) (genesisState map[string]json.RawMessage, genesis *AppGenesis, err error)
- func NewAppGenesisWithVersion(chainID string, appState json.RawMessage) *AppGenesis
- type AppMap
- type ConsensusGenesis
- type GenesisAccountsIterator
- type GenesisBalancesIterator
- type InitConfig
- type MessageValidator
- type MigrationCallback
- type MigrationMap
- type StakingKeeper
Constants ¶
const ChainIDFieldName = "chain_id"
const ( // MaxChainIDLen is the maximum length of a chain ID. MaxChainIDLen = cmttypes.MaxChainIDLen )
const ModuleName = "genutil"
ModuleName is genutil
Variables ¶
This section is empty.
Functions ¶
func DefaultMessageValidator ¶
func GenesisStateFromAppGenesis ¶
func GenesisStateFromAppGenesis(genesis *AppGenesis) (genesisState map[string]json.RawMessage, err error)
GenesisStateFromAppGenesis creates the core parameters for genesis initialization for the application.
NOTE: The pubkey input is this machines pubkey.
func ParseChainIDFromGenesis ¶
ParseChainIDFromGenesis parses the `chain_id` from a genesis JSON file, aborting early after finding the `chain_id`. For efficiency, it's recommended to place the `chain_id` field before any large entries in the JSON file. Returns an error if the `chain_id` field is not found.
func SetGenesisStateInAppState ¶
func SetGenesisStateInAppState( cdc codec.JSONCodec, appState map[string]json.RawMessage, genesisState *GenesisState, ) map[string]json.RawMessage
SetGenesisStateInAppState sets the genutil genesis state within the expected app state
func ValidateAndGetGenTx ¶
func ValidateAndGetGenTx(genTx json.RawMessage, txJSONDecoder sdk.TxDecoder, validator MessageValidator) (sdk.Tx, error)
ValidateAndGetGenTx validates the genesis transaction and returns GenTx if valid it cannot verify the signature as it is stateless validation
func ValidateGenesis ¶
func ValidateGenesis(genesisState *GenesisState, txJSONDecoder sdk.TxDecoder, validator MessageValidator) error
ValidateGenesis validates GenTx transactions
Types ¶
type AccountKeeper ¶
type AccountKeeper interface { NewAccount(context.Context, sdk.AccountI) sdk.AccountI SetAccount(context.Context, sdk.AccountI) IterateAccounts(ctx context.Context, process func(sdk.AccountI) (stop bool)) }
AccountKeeper defines the expected account keeper (noalias)
type AppGenesis ¶
type AppGenesis struct { AppName string `json:"app_name"` AppVersion string `json:"app_version"` GenesisTime time.Time `json:"genesis_time"` ChainID string `json:"chain_id"` InitialHeight int64 `json:"initial_height"` AppHash []byte `json:"app_hash"` AppState json.RawMessage `json:"app_state,omitempty"` Consensus *ConsensusGenesis `json:"consensus,omitempty"` }
AppGenesis defines the app's genesis.
func AppGenesisFromFile ¶
func AppGenesisFromFile(genFile string) (*AppGenesis, error)
AppGenesisFromFile reads the AppGenesis from the provided file.
func AppGenesisFromReader ¶
func AppGenesisFromReader(reader io.Reader) (*AppGenesis, error)
AppGenesisFromReader reads the AppGenesis from the reader.
func GenesisStateFromGenFile ¶
func GenesisStateFromGenFile(genFile string) (genesisState map[string]json.RawMessage, genesis *AppGenesis, err error)
GenesisStateFromGenFile creates the core parameters for genesis initialization for the application.
NOTE: The pubkey input is this machines pubkey.
func NewAppGenesisWithVersion ¶
func NewAppGenesisWithVersion(chainID string, appState json.RawMessage) *AppGenesis
NewAppGenesisWithVersion returns a new AppGenesis with the app name and app version already.
func (*AppGenesis) SaveAs ¶
func (ag *AppGenesis) SaveAs(file string) error
SaveAs is a utility method for saving AppGenesis as a JSON file.
func (*AppGenesis) ToGenesisDoc ¶
func (ag *AppGenesis) ToGenesisDoc() (*cmttypes.GenesisDoc, error)
ToGenesisDoc converts the AppGenesis to a CometBFT GenesisDoc.
func (*AppGenesis) ValidateAndComplete ¶
func (ag *AppGenesis) ValidateAndComplete() error
ValidateAndComplete performs validation and completes the AppGenesis.
type AppMap ¶
type AppMap map[string]json.RawMessage
AppMap map modules names with their json raw representation.
type ConsensusGenesis ¶
type ConsensusGenesis struct { Validators []cmttypes.GenesisValidator `json:"validators,omitempty"` Params *cmttypes.ConsensusParams `json:"params,omitempty"` }
ConsensusGenesis defines the consensus layer's genesis. TODO(@julienrbrt) eventually abstract from CometBFT types
func NewConsensusGenesis ¶
func NewConsensusGenesis(params cmtproto.ConsensusParams, validators []cmttypes.GenesisValidator) *ConsensusGenesis
NewConsensusGenesis returns a ConsensusGenesis with given values. It takes a proto consensus params so it can called from server export command.
func (*ConsensusGenesis) MarshalJSON ¶
func (cs *ConsensusGenesis) MarshalJSON() ([]byte, error)
func (*ConsensusGenesis) UnmarshalJSON ¶
func (cs *ConsensusGenesis) UnmarshalJSON(b []byte) error
func (*ConsensusGenesis) ValidateAndComplete ¶
func (cs *ConsensusGenesis) ValidateAndComplete() error
type GenesisAccountsIterator ¶
type GenesisAccountsIterator interface { IterateGenesisAccounts( cdc *codec.LegacyAmino, appGenesis map[string]json.RawMessage, cb func(sdk.AccountI) (stop bool), ) }
GenesisAccountsIterator defines the expected iterating genesis accounts object (noalias)
type GenesisBalancesIterator ¶
type GenesisBalancesIterator interface { IterateGenesisBalances( cdc codec.JSONCodec, appGenesis map[string]json.RawMessage, cb func(bankexported.GenesisBalance) (stop bool), ) }
GenesisAccountsIterator defines the expected iterating genesis accounts object (noalias)
type InitConfig ¶
type InitConfig struct { ChainID string GenTxsDir string NodeID string ValPubKey cryptotypes.PubKey }
InitConfig common config options for init
func NewInitConfig ¶
func NewInitConfig(chainID, genTxsDir, nodeID string, valPubKey cryptotypes.PubKey) InitConfig
NewInitConfig creates a new InitConfig object
type MessageValidator ¶
type MigrationCallback ¶
MigrationCallback converts a genesis map from the previous version to the targeted one.
type MigrationMap ¶
type MigrationMap map[string]MigrationCallback
MigrationMap defines a mapping from a version to a MigrationCallback.
type StakingKeeper ¶
type StakingKeeper interface {
ApplyAndReturnValidatorSetUpdates(context.Context) (updates []abci.ValidatorUpdate, err error)
}
StakingKeeper defines the expected staking keeper (noalias)