Documentation
¶
Index ¶
- Variables
- func AddCommands(ctx *server.Context, cdc *codec.Codec, rootCmd *cobra.Command, ...)
- func AppGenStateJSON(cdc *codec.Codec, genDoc tmtypes.GenesisDoc, appGenTxs []json.RawMessage) (appState json.RawMessage, err error)
- func CollectStdTxs(cdc *codec.Codec, moniker string, genTxsDir string, genDoc tmtypes.GenesisDoc) (appGenTxs []auth.StdTx, persistentPeers string, err error)
- func ExternalIP() (string, error)
- func InsertKeyJSON(cdc *codec.Codec, baseJSON []byte, key string, value json.RawMessage) ([]byte, error)
- func MakeCodec() *codec.Codec
- func PersistentPreRunEFn(context *server.Context) func(*cobra.Command, []string) error
- func TrapSignal(cleanupFunc func())
- func UpgradeOldPrivValFile(config *cfg.Config)
- func ValidateGenesisState(genesisState GenesisState) error
- type CarnotApp
- func (app *CarnotApp) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock
- func (app *CarnotApp) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock
- func (app *CarnotApp) ExportAppStateAndValidators(forZeroHeight bool, jailWhiteList []string) (appState json.RawMessage, validators []tmtypes.GenesisValidator, err error)
- func (app *CarnotApp) LoadHeight(height int64) error
- type Context
- type GenesisAccount
- type GenesisState
- type StakingHooks
- func (h StakingHooks) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)
- func (h StakingHooks) AfterValidatorBeginUnbonding(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)
- func (h StakingHooks) AfterValidatorBonded(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)
- func (h StakingHooks) AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress)
- func (h StakingHooks) AfterValidatorRemoved(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)
- func (h StakingHooks) BeforeDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)
- func (h StakingHooks) BeforeDelegationRemoved(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)
- func (h StakingHooks) BeforeDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)
- func (h StakingHooks) BeforeValidatorModified(ctx sdk.Context, valAddr sdk.ValAddress)
- func (h StakingHooks) BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, fraction sdk.Dec)
Constants ¶
This section is empty.
Variables ¶
var ( DefaultNodeHome = os.ExpandEnv("$HOME/.carnot") DefaultCLIHome = os.ExpandEnv("$HOME/.carnot-cli") InitKeystore = "" InitPassword = "" ValidatorName = "" ValidatorPass = "" RPCPort = 26657 KeyPath = "" )
default home directories for expected binaries
Functions ¶
func AddCommands ¶
func AddCommands( ctx *server.Context, cdc *codec.Codec, rootCmd *cobra.Command, appCreator server.AppCreator, appExport server.AppExporter)
add server commands
func AppGenStateJSON ¶
func AppGenStateJSON(cdc *codec.Codec, genDoc tmtypes.GenesisDoc, appGenTxs []json.RawMessage) ( appState json.RawMessage, err error)
AppGenState but with JSON
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 ExternalIP ¶
https://stackoverflow.com/questions/23558425/how-do-i-get-the-local-ip-address-in-go TODO there must be a better way to get external IP
func InsertKeyJSON ¶
func InsertKeyJSON(cdc *codec.Codec, baseJSON []byte, key string, value json.RawMessage) ([]byte, error)
InsertKeyJSON inserts a new JSON field/key with a given value to an existing JSON message. An error is returned if any serialization operation fails.
NOTE: The ordering of the keys returned as the resulting JSON message is non-deterministic, so the client should not rely on key ordering.
func PersistentPreRunEFn ¶
PersistentPreRunEFn returns a PersistentPreRunE function for cobra that initailizes the passed in context with a properly configured logger and config object.
func TrapSignal ¶
func TrapSignal(cleanupFunc func())
TrapSignal traps SIGINT and SIGTERM and terminates the server correctly.
func UpgradeOldPrivValFile ¶
UpgradeOldPrivValFile converts old priv_validator.json file (prior to Tendermint 0.28) to the new priv_validator_key.json and priv_validator_state.json files.
func ValidateGenesisState ¶
func ValidateGenesisState(genesisState GenesisState) error
ValidateGenesisState 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)
Types ¶
type CarnotApp ¶
Extended ABCI application
func NewCarnotApp ¶
func NewCarnotApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest, assertInvariantsBlockly bool, baseAppOptions ...func(*bam.BaseApp)) *CarnotApp
NewCarnotApp returns a reference to an initialized CarnotApp.
func (*CarnotApp) BeginBlocker ¶
func (app *CarnotApp) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock
application updates every end block
func (*CarnotApp) EndBlocker ¶
func (app *CarnotApp) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock
application updates every end block nolint: unparam
func (*CarnotApp) ExportAppStateAndValidators ¶
func (app *CarnotApp) ExportAppStateAndValidators(forZeroHeight bool, jailWhiteList []string) ( appState json.RawMessage, validators []tmtypes.GenesisValidator, err error)
export the state of carnot for a genesis file
func (*CarnotApp) LoadHeight ¶
load a particular height
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 defines an account initialized at genesis.
func NewDefaultGenesisAccount ¶
func NewDefaultGenesisAccount(addr sdk.AccAddress) GenesisAccount
func NewGenesisAccount ¶
func NewGenesisAccount(acc *auth.BaseAccount) GenesisAccount
func NewGenesisAccountI ¶
func NewGenesisAccountI(acc auth.Account) GenesisAccount
func (*GenesisAccount) ToAccount ¶
func (ga *GenesisAccount) ToAccount() auth.Account
convert GenesisAccount to auth.BaseAccount
type GenesisState ¶
type GenesisState struct { Accounts []GenesisAccount `json:"accounts"` AuthData auth.GenesisState `json:"auth"` BankData bank.GenesisState `json:"bank"` StakingData staking.GenesisState `json:"staking"` MintData mint.GenesisState `json:"mint"` DistrData distr.GenesisState `json:"distr"` GovData gov.GenesisState `json:"gov"` CrisisData crisis.GenesisState `json:"crisis"` SlashingData slashing.GenesisState `json:"slashing"` GenTxs []json.RawMessage `json:"gentxs"` }
State to Unmarshal
func AppGenState ¶
func AppGenState(cdc *codec.Codec, genDoc tmtypes.GenesisDoc, appGenTxs []json.RawMessage) ( genesisState GenesisState, err error)
Create the core parameters for genesis initialization for carnot note that the pubkey input is this machines pubkey
func NewDefaultGenesisState ¶
func NewDefaultGenesisState() GenesisState
NewDefaultGenesisState generates the default state for carnot.
func NewGenesisState ¶
func NewGenesisState(accounts []GenesisAccount, authData auth.GenesisState, bankData bank.GenesisState, stakingData staking.GenesisState, mintData mint.GenesisState, distrData distr.GenesisState, govData gov.GenesisState, crisisData crisis.GenesisState, slashingData slashing.GenesisState) GenesisState
func (GenesisState) Sanitize ¶
func (gs GenesisState) Sanitize()
Sanitize sorts accounts and coin sets.
type StakingHooks ¶
type StakingHooks struct {
// contains filtered or unexported fields
}
StakingHooks contains combined distribution and slashing hooks needed for the staking module.
func NewStakingHooks ¶
func NewStakingHooks(dh distr.Hooks, sh slashing.Hooks) StakingHooks
func (StakingHooks) AfterDelegationModified ¶
func (h StakingHooks) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)
func (StakingHooks) AfterValidatorBeginUnbonding ¶
func (h StakingHooks) AfterValidatorBeginUnbonding(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)
func (StakingHooks) AfterValidatorBonded ¶
func (h StakingHooks) AfterValidatorBonded(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)
func (StakingHooks) AfterValidatorCreated ¶
func (h StakingHooks) AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress)
nolint
func (StakingHooks) AfterValidatorRemoved ¶
func (h StakingHooks) AfterValidatorRemoved(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)
func (StakingHooks) BeforeDelegationCreated ¶
func (h StakingHooks) BeforeDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)
func (StakingHooks) BeforeDelegationRemoved ¶
func (h StakingHooks) BeforeDelegationRemoved(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)
func (StakingHooks) BeforeDelegationSharesModified ¶
func (h StakingHooks) BeforeDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)
func (StakingHooks) BeforeValidatorModified ¶
func (h StakingHooks) BeforeValidatorModified(ctx sdk.Context, valAddr sdk.ValAddress)
func (StakingHooks) BeforeValidatorSlashed ¶
func (h StakingHooks) BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, fraction sdk.Dec)