Documentation ¶
Index ¶
- Constants
- func Document(ecfg encoding.Config, params *tmproto.ConsensusParams, chainID string, ...) (*coretypes.GenesisDoc, error)
- func GenerateEd25519(seed []byte) crypto.PrivKey
- func InitFiles(rootDir string, tmConfig *config.Config, appCfg *srvconfig.Config, ...) error
- func NewSeed(r *mrand.Rand) []byte
- type Account
- type Genesis
- func (g *Genesis) Accounts() []Account
- func (g *Genesis) AddAccount(account Account) error
- func (g *Genesis) AddValidator(val Validator) error
- func (g *Genesis) EncodingConfig() encoding.Config
- func (g *Genesis) Export() (*coretypes.GenesisDoc, error)
- func (g *Genesis) Keyring() keyring.Keyring
- func (g *Genesis) NewAccount(acc KeyringAccount) error
- func (g *Genesis) NewValidator(val Validator) error
- func (g *Genesis) Validator(i int) (Validator, bool)
- func (g *Genesis) Validators() []Validator
- func (g *Genesis) WithChainID(chainID string) *Genesis
- func (g *Genesis) WithConsensusParams(params *tmproto.ConsensusParams) *Genesis
- func (g *Genesis) WithGenesisTime(genesisTime time.Time) *Genesis
- func (g *Genesis) WithKeyring(kr keyring.Keyring) *Genesis
- func (g *Genesis) WithKeyringAccounts(accs ...KeyringAccount) *Genesis
- func (g *Genesis) WithModifiers(ops ...Modifier) *Genesis
- func (g *Genesis) WithValidators(vals ...Validator) *Genesis
- type KeyringAccount
- type Modifier
- func FundAccounts(codec codec.Codec, addresses []sdk.AccAddress, balance sdk.Coin) Modifier
- func ImmediateProposals(codec codec.Codec) Modifier
- func SetBlobParams(codec codec.Codec, params blobtypes.Params) Modifier
- func SetDataCommitmentWindow(codec codec.Codec, window uint64) Modifier
- func SetSlashingParams(codec codec.Codec, parans slashingtypes.Params) Modifier
- type Validator
Constants ¶
const (
DefaultInitialBalance = 1e15 // 1 billion TIA
)
Variables ¶
This section is empty.
Functions ¶
func Document ¶
func Document( ecfg encoding.Config, params *tmproto.ConsensusParams, chainID string, gentxs []json.RawMessage, accounts []Account, genesisTime time.Time, mods ...Modifier, ) (*coretypes.GenesisDoc, error)
Document will create a valid genesis doc with funded addresses.
func GenerateEd25519 ¶
Types ¶
type Account ¶
type Account struct { PubKey cryptotypes.PubKey Balance int64 Name string }
func (Account) ValidateBasic ¶
type Genesis ¶
type Genesis struct { // ConsensusParams are the consensus parameters of the network. ConsensusParams *tmproto.ConsensusParams // ChainID is the chain ID of the network. ChainID string // GenesisTime is the genesis time of the network. GenesisTime time.Time // contains filtered or unexported fields }
Genesis manages the creation of the genesis state of a network. It is meant to be used as the first step to any test that requires a network.
func NewDefaultGenesis ¶
func NewDefaultGenesis() *Genesis
NewDefaultGenesis creates a new default genesis with no accounts or validators.
func (*Genesis) AddAccount ¶
AddAccount adds an existing account to the genesis.
func (*Genesis) AddValidator ¶
AddValidator verifies and adds a given validator to the genesis.
func (*Genesis) EncodingConfig ¶
func (*Genesis) Export ¶
func (g *Genesis) Export() (*coretypes.GenesisDoc, error)
Export returns the genesis document of the network.
func (*Genesis) NewAccount ¶
func (g *Genesis) NewAccount(acc KeyringAccount) error
NewAccount creates a new account and adds it to the genesis.
func (*Genesis) NewValidator ¶
NewValidator creates a new validator account and adds it to the genesis.
func (*Genesis) Validator ¶
Validator returns the validator at the given index. False is returned if the index is out of bounds.
func (*Genesis) WithChainID ¶
WithChainID sets the chain ID of the genesis.
func (*Genesis) WithConsensusParams ¶
func (g *Genesis) WithConsensusParams(params *tmproto.ConsensusParams) *Genesis
WithConsensusParams sets the consensus parameters of the genesis.
func (*Genesis) WithGenesisTime ¶
WithGenesisTime sets the genesis time of the genesis.
func (*Genesis) WithKeyringAccounts ¶
func (g *Genesis) WithKeyringAccounts(accs ...KeyringAccount) *Genesis
WithKeyringAccounts adds the given keyring accounts to the genesis. If an account with the same name already exists, it panics.
func (*Genesis) WithModifiers ¶
WithModifiers adds a genesis modifier to the genesis.
func (*Genesis) WithValidators ¶
WithValidators adds the given validators to the genesis.
type KeyringAccount ¶
KeyringAccount represents a user account on the Celestia network. Either the name, if using the genesis keyring, or an address needs to be provided
func NewKeyringAccounts ¶
func NewKeyringAccounts(initBal int64, names ...string) []KeyringAccount
func (*KeyringAccount) ValidateBasic ¶
func (ga *KeyringAccount) ValidateBasic() error
type Modifier ¶
type Modifier func(state map[string]json.RawMessage) map[string]json.RawMessage
Modifier allows for arbitrary changes to be made on the genesis state after initial accounts have been added. It accepts the genesis state as input and is expected to return the modified genesis as output.
func FundAccounts ¶
FundAccounts adds a set of accounts to the genesis and then sets their balance as provided. This is good in the case where you have a separate keyring you want to test against and not use the one generated by the testnet infra.
func ImmediateProposals ¶
ImmediateProposals sets the thresholds for getting a gov proposal to very low levels.
func SetBlobParams ¶
SetBlobParams will set the provided blob params as genesis state.
func SetDataCommitmentWindow ¶
SetDataCommitmentWindow will set the provided data commitment window in the blobstream module's genesis state.
func SetSlashingParams ¶
func SetSlashingParams(codec codec.Codec, parans slashingtypes.Params) Modifier
SetSlashingParams will set the provided slashing params as genesis state.
type Validator ¶
type Validator struct { KeyringAccount Stake int64 // ConsensusKey is the key used by the validator to sign votes. ConsensusKey crypto.PrivKey NetworkKey crypto.PrivKey }
func NewDefaultValidator ¶
func (*Validator) GenTx ¶
GenTx generates a genesis transaction to create a validator as configured by the validator struct. It assumes the validator's genesis account has already been added to the keyring and that the sequence for that account is 0.
func (*Validator) ValidateBasic ¶
ValidateBasic performs stateless validation on the validitor