Documentation ¶
Index ¶
- func Threshold(_ uint64) sdk.Dec
- func VersionFromBytes(version []byte) uint64
- func VersionToBytes(version uint64) []byte
- type AppModule
- func (AppModule) ConsensusVersion() uint64
- func (am AppModule) ExportGenesis(_ sdk.Context, cdc codec.JSONCodec) json.RawMessage
- func (AppModule) InitGenesis(_ sdk.Context, _ codec.JSONCodec, _ json.RawMessage) []abci.ValidatorUpdate
- func (AppModule) LegacyQuerierHandler(_ *codec.LegacyAmino) sdk.Querier
- func (AppModule) QuerierRoute() string
- func (AppModule) RegisterInvariants(_ sdk.InvariantRegistry)
- func (am AppModule) RegisterServices(cfg module.Configurator)
- func (AppModule) Route() sdk.Route
- type AppModuleBasic
- func (AppModuleBasic) DefaultGenesis(_ codec.JSONCodec) json.RawMessage
- func (AppModuleBasic) GetQueryCmd() *cobra.Command
- func (AppModuleBasic) GetTxCmd() *cobra.Command
- func (AppModuleBasic) Name() string
- func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux)
- func (AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry)
- func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino)
- func (AppModuleBasic) ValidateGenesis(_ codec.JSONCodec, _ client.TxEncodingConfig, _ json.RawMessage) error
- type Keeper
- func (k Keeper) DeleteValidatorVersion(ctx sdk.Context, valAddress sdk.ValAddress)
- func (k Keeper) GetUpgrade(ctx context.Context, _ *types.QueryGetUpgradeRequest) (*types.QueryGetUpgradeResponse, error)
- func (k Keeper) GetVotingPowerThreshold(ctx sdk.Context) sdkmath.Int
- func (k *Keeper) IsUpgradePending(ctx sdk.Context) bool
- func (k *Keeper) ResetTally(ctx sdk.Context)
- func (k Keeper) SetValidatorVersion(ctx sdk.Context, valAddress sdk.ValAddress, version uint64)
- func (k *Keeper) ShouldUpgrade(ctx sdk.Context) (isQuorumVersion bool, version uint64)
- func (k Keeper) SignalVersion(ctx context.Context, req *types.MsgSignalVersion) (*types.MsgSignalVersionResponse, error)
- func (k Keeper) TallyVotingPower(ctx sdk.Context, threshold int64) (bool, uint64)
- func (k *Keeper) TryUpgrade(ctx context.Context, _ *types.MsgTryUpgrade) (*types.MsgTryUpgradeResponse, error)
- func (k Keeper) VersionTally(ctx context.Context, req *types.QueryVersionTallyRequest) (*types.QueryVersionTallyResponse, error)
- type StakingKeeper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Threshold ¶
Threshold is the fraction of voting power that is required to signal for a version change. It is set to 5/6 as the middle point between 2/3 and 3/3 providing 1/6 fault tolerance to halting the network during an upgrade period. It can be modified through a hard fork change that modified the app version
func VersionFromBytes ¶
func VersionToBytes ¶
Types ¶
type AppModule ¶
type AppModule struct { AppModuleBasic // contains filtered or unexported fields }
AppModule implements the sdk.AppModule interface
func NewAppModule ¶
NewAppModule creates a new AppModule object
func (AppModule) ConsensusVersion ¶
ConsensusVersion returns the consensus version of this module.
func (AppModule) ExportGenesis ¶
ExportGenesis is always empty, as InitGenesis does nothing either.
func (AppModule) InitGenesis ¶
func (AppModule) InitGenesis(_ sdk.Context, _ codec.JSONCodec, _ json.RawMessage) []abci.ValidatorUpdate
InitGenesis does nothing because there is no sense in serializing future upgrades.
func (AppModule) LegacyQuerierHandler ¶
func (AppModule) LegacyQuerierHandler(_ *codec.LegacyAmino) sdk.Querier
LegacyQuerierHandler returns nil because there are no legacy queriers.
func (AppModule) QuerierRoute ¶
QuerierRoute returns the query routing key used for ABCI queries.
func (AppModule) RegisterInvariants ¶
func (AppModule) RegisterInvariants(_ sdk.InvariantRegistry)
RegisterInvariants does nothing because there are no invariants to enforce.
func (AppModule) RegisterServices ¶
func (am AppModule) RegisterServices(cfg module.Configurator)
RegisterServices registers module services.
type AppModuleBasic ¶
type AppModuleBasic struct{}
AppModuleBasic implements the sdk.AppModuleBasic interface
func (AppModuleBasic) DefaultGenesis ¶
func (AppModuleBasic) DefaultGenesis(_ codec.JSONCodec) json.RawMessage
DefaultGenesis returns an empty object.
func (AppModuleBasic) GetQueryCmd ¶
func (AppModuleBasic) GetQueryCmd() *cobra.Command
GetQueryCmd returns the CLI query commands for this module.
func (AppModuleBasic) GetTxCmd ¶
func (AppModuleBasic) GetTxCmd() *cobra.Command
GetTxCmd returns the CLI transaction commands for this module.
func (AppModuleBasic) RegisterGRPCGatewayRoutes ¶
func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux)
RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the upgrade module.
func (AppModuleBasic) RegisterInterfaces ¶
func (AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry)
RegisterInterfaces registers the module's interface types on the InterfaceRegistry.
func (AppModuleBasic) RegisterLegacyAminoCodec ¶
func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino)
RegisterLegacyAminoCodec registers the upgrade types on the LegacyAmino codec
func (AppModuleBasic) ValidateGenesis ¶
func (AppModuleBasic) ValidateGenesis(_ codec.JSONCodec, _ client.TxEncodingConfig, _ json.RawMessage) error
ValidateGenesis is always successful, as we ignore the value.
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
func NewKeeper ¶
func NewKeeper( binaryCodec codec.BinaryCodec, storeKey storetypes.StoreKey, stakingKeeper StakingKeeper, ) Keeper
NewKeeper returns a signal keeper.
func (Keeper) DeleteValidatorVersion ¶
func (k Keeper) DeleteValidatorVersion(ctx sdk.Context, valAddress sdk.ValAddress)
DeleteValidatorVersion deletes a signalled version for a validator.
func (Keeper) GetUpgrade ¶
func (k Keeper) GetUpgrade(ctx context.Context, _ *types.QueryGetUpgradeRequest) (*types.QueryGetUpgradeResponse, error)
GetUpgrade returns the current upgrade information.
func (Keeper) GetVotingPowerThreshold ¶
GetVotingPowerThreshold returns the voting power threshold required to upgrade to a new version.
func (*Keeper) IsUpgradePending ¶
IsUpgradePending returns true if an app version has reached quorum and the chain should upgrade to the app version at the upgrade height. While the keeper has an upgrade pending the SignalVersion and TryUpgrade messages will be rejected.
func (*Keeper) ResetTally ¶
ResetTally resets the tally after a version change. It iterates over the store and deletes all versions. It also resets the quorumVersion and upgradeHeight to 0.
func (Keeper) SetValidatorVersion ¶
SetValidatorVersion saves a signalled version for a validator.
func (*Keeper) ShouldUpgrade ¶
ShouldUpgrade returns whether the signalling mechanism has concluded that the network is ready to upgrade and the version to upgrade to. It returns false and 0 if no version has reached quorum.
func (Keeper) SignalVersion ¶
func (k Keeper) SignalVersion(ctx context.Context, req *types.MsgSignalVersion) (*types.MsgSignalVersionResponse, error)
SignalVersion is a method required by the MsgServer interface.
func (Keeper) TallyVotingPower ¶
TallyVotingPower tallies the voting power for each version and returns true and the version if any version has reached the quorum in voting power. Returns false and 0 otherwise.
func (*Keeper) TryUpgrade ¶
func (k *Keeper) TryUpgrade(ctx context.Context, _ *types.MsgTryUpgrade) (*types.MsgTryUpgradeResponse, error)
TryUpgrade is a method required by the MsgServer interface. It tallies the voting power that has voted on each version. If one version has reached a quorum, an upgrade is persisted to the store. The upgrade is used by the application later when it is time to upgrade to that version.
func (Keeper) VersionTally ¶
func (k Keeper) VersionTally(ctx context.Context, req *types.QueryVersionTallyRequest) (*types.QueryVersionTallyResponse, error)
VersionTally enables a client to query for the tally of voting power has signalled for a particular version.