Documentation ¶
Index ¶
- 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 (am AppModule) InitGenesis(_ sdk.Context, _ codec.JSONCodec, _ json.RawMessage) []abci.ValidatorUpdate
- func (am 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.Routedeprecated
- 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 (b AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry)
- func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino)
- func (AppModuleBasic) ValidateGenesis(_ codec.JSONCodec, _ client.TxEncodingConfig, _ json.RawMessage) error
- type Fraction
- type Keeper
- func (k Keeper) ClearIBCState(ctx sdk.Context, lastHeight int64)
- func (k Keeper) DeleteValidatorVersion(ctx sdk.Context, valAddress sdk.ValAddress)
- func (k Keeper) GetUpgradePlan(_ sdk.Context) (plan types.Plan, havePlan bool)
- func (k Keeper) GetUpgradedClient(ctx sdk.Context, height int64) ([]byte, bool)
- func (k Keeper) GetUpgradedConsensusState(ctx sdk.Context, lastHeight int64) ([]byte, bool)
- func (k Keeper) GetVotingPowerThreshold(ctx sdk.Context) sdkmath.Int
- func (k *Keeper) ResetTally(ctx sdk.Context, version uint64)
- func (k Keeper) ScheduleUpgrade(_ sdk.Context, _ types.Plan) error
- func (k Keeper) SetUpgradedClient(ctx sdk.Context, planHeight int64, bz []byte) error
- func (k Keeper) SetUpgradedConsensusState(ctx sdk.Context, planHeight int64, bz []byte) error
- func (k Keeper) SetValidatorVersion(ctx sdk.Context, valAddress sdk.ValAddress, version uint64)
- func (k *Keeper) ShouldUpgrade() (bool, uint64)
- func (k Keeper) ShouldUpgradeToV2(height int64) bool
- 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 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 implements AppModule/ConsensusVersion.
func (AppModule) ExportGenesis ¶
ExportGenesis is always empty, as InitGenesis does nothing either
func (AppModule) InitGenesis ¶
func (am AppModule) InitGenesis(_ sdk.Context, _ codec.JSONCodec, _ json.RawMessage) []abci.ValidatorUpdate
InitGenesis is ignored, no sense in serializing future upgrades
func (AppModule) LegacyQuerierHandler ¶
func (am AppModule) LegacyQuerierHandler(_ *codec.LegacyAmino) sdk.Querier
LegacyQuerierHandler registers a query handler to respond to the module-specific queries
func (AppModule) QuerierRoute ¶
QuerierRoute returns the route we respond to for abci queries
func (AppModule) RegisterInvariants ¶
func (AppModule) RegisterInvariants(_ sdk.InvariantRegistry)
RegisterInvariants does nothing, 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 is 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 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 (b AppModuleBasic) RegisterInterfaces(registry codectypes.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 Fraction ¶
func SignalThreshold ¶
SignalThreshold 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
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
func NewKeeper ¶
func NewKeeper( storeKey storetypes.StoreKey, upgradeHeight int64, stakingKeeper StakingKeeper, ) Keeper
NewKeeper constructs an upgrade keeper
func (Keeper) ClearIBCState ¶
ClearIBCState clears any planned IBC state
func (Keeper) DeleteValidatorVersion ¶
func (k Keeper) DeleteValidatorVersion(ctx sdk.Context, valAddress sdk.ValAddress)
DeleteValidatorVersion deletes a signalled version for a validator using the keeper's store key
func (Keeper) GetUpgradePlan ¶
GetUpgradePlan implements the ibc upgrade keeper interface. This is used in BeginBlock to know when to write the upgraded consensus state. The IBC module needs to sign over the next consensus state to ensure a smooth transition for counterparty chains. This is implemented as a noop. Any IBC breaking change would be invoked by this upgrade module in end blocker.
func (Keeper) GetUpgradedClient ¶
GetUpgradedClient gets the expected upgraded client for the next version of this chain
func (Keeper) GetUpgradedConsensusState ¶
GetUpgradedConsensusState get the expected upgraded consensus state for the next version of this chain
func (Keeper) GetVotingPowerThreshold ¶
GetVotingPowerThreshold returns the voting power threshold required to upgrade to a new version.
func (*Keeper) ResetTally ¶
ResetTally resets the tally after a version change. It iterates over the store, and deletes any versions that are less than the provided version. It also resets the quorumVersion to 0.
func (Keeper) ScheduleUpgrade ¶
ScheduleUpgrade implements the ibc upgrade keeper interface. This is a noop as no other process is allowed to schedule an upgrade but the upgrade keeper itself. This is kept around to support the interface.
func (Keeper) SetUpgradedClient ¶
SetUpgradedClient sets the expected upgraded client for the next version of this chain at the last height the current chain will commit.
func (Keeper) SetUpgradedConsensusState ¶
SetUpgradedConsensusState set the expected upgraded consensus state for the next version of this chain using the last height committed on this chain.
func (Keeper) SetValidatorVersion ¶
SetValidatorVersion saves a signalled version for a validator using the keeper's store key
func (*Keeper) ShouldUpgrade ¶
ShouldUpgrade returns true if the signalling mechanism has concluded that the network is ready to upgrade. It also returns the version that the node should upgrade to.
func (Keeper) ShouldUpgradeToV2 ¶
ShouldUpgradeToV2 returns true if the current height is one before the locally provided upgrade height that is passed as a flag NOTE: This is only used to upgrade to v2 and should be deprecated in v3
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 if any version has reached the quorum in voting power
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 quorum, it is set as the quorum version which the application can use as signal to upgrade to that version.
func (Keeper) VersionTally ¶
func (k Keeper) VersionTally(ctx context.Context, req *types.QueryVersionTallyRequest) (*types.QueryVersionTallyResponse, error)
VersionTally is a method required by the QueryServer interface