keeper

package
v3.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 8, 2024 License: Apache-2.0 Imports: 28 Imported by: 26

Documentation

Index

Constants

View Source
const RetryDelayPeriod = time.Hour

Retry delay period could be implemented as a param, but 1 hour is reasonable

Variables

This section is empty.

Functions

func PendingDataPacketsKeyOnlyForTesting added in v3.2.0

func PendingDataPacketsKeyOnlyForTesting() []byte

Types

type ConsumerPacketDataWithIdx added in v3.2.0

type ConsumerPacketDataWithIdx struct {
	ccv.ConsumerPacketData // Struct embedding
	Idx                    uint64
}

ConsumerPacketDataWithIdx is a wrapper around ConsumerPacketData that also stores the index of the packet in the pending packets queue.

Note this type is a shim to avoid changing the schema of ConsumerPacketData and breaking the wire.

type Hooks

type Hooks struct {
	// contains filtered or unexported fields
}

Hooks wrapper struct for ConsumerKeeper

type Keeper

type Keeper struct {
	// contains filtered or unexported fields
}

Keeper defines the Cross-Chain Validation Consumer Keeper

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec, key storetypes.StoreKey, paramSpace paramtypes.Subspace,
	scopedKeeper ccv.ScopedKeeper,
	channelKeeper ccv.ChannelKeeper, portKeeper ccv.PortKeeper,
	connectionKeeper ccv.ConnectionKeeper, clientKeeper ccv.ClientKeeper,
	slashingKeeper ccv.SlashingKeeper, bankKeeper ccv.BankKeeper, accountKeeper ccv.AccountKeeper,
	ibcTransferKeeper ccv.IBCTransferKeeper, ibcCoreKeeper ccv.IBCCoreKeeper,
	feeCollectorName string,
) Keeper

NewKeeper creates a new Consumer Keeper instance NOTE: the feeCollectorName is in reference to the consumer-chain fee collector (and not the provider chain)

func NewNonZeroKeeper

func NewNonZeroKeeper(cdc codec.BinaryCodec, key storetypes.StoreKey, paramSpace paramtypes.Subspace) Keeper

Returns a keeper with cdc, key and paramSpace set it does not raise any panics during registration (eg with IBCKeeper). Used only in testing.

func (Keeper) AfterValidatorBonded

func (k Keeper) AfterValidatorBonded(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error

func (Keeper) AllowedRewardDenoms

func (k Keeper) AllowedRewardDenoms(ctx sdk.Context) []string

AllowedRewardDenoms returns a list of all denoms that are allowed to be sent to the provider as rewards

func (Keeper) AppendPendingPacket

func (k Keeper) AppendPendingPacket(ctx sdk.Context, packetType ccv.ConsumerPacketDataType, data ccv.ExportedIsConsumerPacketData_Data)

AppendPendingPacket enqueues the given data packet to the end of the pending data packets queue

func (Keeper) ApplyAndReturnValidatorSetUpdates

func (k Keeper) ApplyAndReturnValidatorSetUpdates(sdk.Context) (updates []abci.ValidatorUpdate, err error)

implement interface method needed for x/genutil in sdk v47 returns empty updates and err

func (Keeper) ApplyCCValidatorChanges

func (k Keeper) ApplyCCValidatorChanges(ctx sdk.Context, changes []abci.ValidatorUpdate) []abci.ValidatorUpdate

ApplyCCValidatorChanges applies the given changes to the cross-chain validators states and returns updates to forward to tendermint.

func (Keeper) AuthenticateCapability

func (k Keeper) AuthenticateCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) bool

AuthenticateCapability wraps the scopedKeeper's AuthenticateCapability function

func (Keeper) BindPort

func (k Keeper) BindPort(ctx sdk.Context, portID string) error

BindPort defines a wrapper function for the ort Keeper's function in order to expose it to module's InitGenesis function

func (Keeper) ChanCloseInit

func (k Keeper) ChanCloseInit(ctx sdk.Context, portID, channelID string) error

ChanCloseInit defines a wrapper function for the channel Keeper's function Following ICS 004: https://github.com/cosmos/ibc/tree/main/spec/core/ics-004-channel-and-packet-semantics#closing-handshake

func (Keeper) ChangeoverIsComplete

func (k Keeper) ChangeoverIsComplete(ctx sdk.Context) bool

ChangeoverIsComplete returns whether the standalone to consumer changeover process is complete.

func (Keeper) ChangeoverToConsumer

func (k Keeper) ChangeoverToConsumer(ctx sdk.Context) (initialValUpdates []abci.ValidatorUpdate)

ChangeoverToConsumer includes the logic that needs to execute during the process of a standalone to consumer changeover, where the previously standalone chain has just been upgraded to include the consumer ccv module, but the provider valset is not yet responsible for POS/block production. This method constructs validator updates that will be given to tendermint, which allows the consumer chain to start using the provider valset, while the standalone valset is given zero voting power where appropriate.

func (Keeper) ClaimCapability

func (k Keeper) ClaimCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) error

ClaimCapability claims a capability that the IBC module passes to it

func (Keeper) ClearSlashRecord added in v3.2.0

func (k Keeper) ClearSlashRecord(ctx sdktypes.Context)

func (Keeper) Delegation

Delegation - unimplemented on CCV keeper

func (Keeper) DeleteAllPendingDataPackets added in v3.2.0

func (k Keeper) DeleteAllPendingDataPackets(ctx sdk.Context)

func (Keeper) DeleteCCValidator

func (k Keeper) DeleteCCValidator(ctx sdk.Context, addr []byte)

DeleteCCValidator deletes a cross-chain validator for a given address

func (Keeper) DeleteHeadOfPendingPackets added in v3.2.0

func (k Keeper) DeleteHeadOfPendingPackets(ctx sdk.Context)

DeleteHeadOfPendingPackets deletes the head of the pending packets queue.

func (Keeper) DeleteHeightValsetUpdateID

func (k Keeper) DeleteHeightValsetUpdateID(ctx sdk.Context, height uint64)

DeleteHeightValsetUpdateID deletes the valset update id for a given block height

func (Keeper) DeleteHistoricalInfo

func (k Keeper) DeleteHistoricalInfo(ctx sdk.Context, height int64)

DeleteHistoricalInfo deletes the historical info at a given height

func (Keeper) DeleteOutstandingDowntime

func (k Keeper) DeleteOutstandingDowntime(ctx sdk.Context, consAddress string)

DeleteOutstandingDowntime deletes the outstanding downtime flag for the given validator consensus address

func (Keeper) DeletePacketMaturityTimes

func (k Keeper) DeletePacketMaturityTimes(ctx sdk.Context, vscId uint64, maturityTime time.Time)

DeletePacketMaturityTimes deletes the packet maturity time for a given vscId and maturityTime

func (Keeper) DeletePendingChanges

func (k Keeper) DeletePendingChanges(ctx sdk.Context)

DeletePendingChanges deletes the pending changes after they've been flushed to ABCI

func (Keeper) DeletePendingDataPackets

func (k Keeper) DeletePendingDataPackets(ctx sdk.Context, idxs ...uint64)

DeletePendingDataPackets deletes pending data packets with given indexes

func (Keeper) DeletePreCCV

func (k Keeper) DeletePreCCV(ctx sdk.Context)

func (Keeper) DeleteProviderChannel

func (k Keeper) DeleteProviderChannel(ctx sdk.Context)

DeleteProviderChannel deletes the channelID for the channel to the provider.

func (Keeper) DistributeRewardsInternally

func (k Keeper) DistributeRewardsInternally(ctx sdk.Context)

DistributeRewardsInternally splits the block rewards according to the ConsumerRedistributionFrac param. Returns true if it's time to send rewards to provider

func (Keeper) EndBlockRD

func (k Keeper) EndBlockRD(ctx sdk.Context)

EndBlockRD executes EndBlock logic for the Reward Distribution sub-protocol. Reward Distribution follows a simple model: send tokens to the fee pool of the provider validator set

func (Keeper) ExportGenesis

func (k Keeper) ExportGenesis(ctx sdk.Context) (genesis *types.GenesisState)

ExportGenesis returns the CCV consumer module's exported genesis

func (Keeper) FirstConsumerHeight

func (k Keeper) FirstConsumerHeight(ctx sdk.Context) int64

FirstConsumerHeight returns the first height that the ccv valset will be in effect is 2 blocks after init genesis height (aka height that the ccv module first returned updates to tendermint), because if init genesis is block N, the new valset is committed in block N+ValidatorUpdateDelay, and in effect for block N+ValidatorUpdateDelay+1.

func (Keeper) GetAllCCValidator

func (k Keeper) GetAllCCValidator(ctx sdk.Context) (validators []types.CrossChainValidator)

GetAllCCValidator returns all cross-chain validators

Note that the cross-chain validators are stored under keys with the following format: CrossChainValidatorBytePrefix | address Thus, the returned array is in ascending order of addresses.

func (Keeper) GetAllHeightToValsetUpdateIDs

func (k Keeper) GetAllHeightToValsetUpdateIDs(ctx sdk.Context) (heightToValsetUpdateIDs []types.HeightToValsetUpdateID)

GetAllHeightToValsetUpdateIDs returns a list of all the block heights to valset update IDs in the store

Note that the block height to vscID mapping is stored under keys with the following format: HeightValsetUpdateIDBytePrefix | height Thus, the returned array is in ascending order of heights.

func (Keeper) GetAllOutstandingDowntimes

func (k Keeper) GetAllOutstandingDowntimes(ctx sdk.Context) (downtimes []types.OutstandingDowntime)

GetAllOutstandingDowntimes gets an array of the validator addresses of outstanding downtime flags

Note that the outstanding downtime flags are stored under keys with the following format: OutstandingDowntimeBytePrefix | consAddress Thus, the returned array is in ascending order of consAddresses.

func (Keeper) GetAllPacketMaturityTimes

func (k Keeper) GetAllPacketMaturityTimes(ctx sdk.Context) (maturingVSCPackets []types.MaturingVSCPacket)

GetAllPacketMaturityTimes returns a slice of all PacketMaturityTimes, sorted by maturity times.

Note that PacketMaturityTimes are stored under keys with the following format: PacketMaturityTimeBytePrefix | maturityTime.UnixNano() | vscID Thus, the returned array is in ascending order of maturityTimes. If two entries have the same maturityTime, then they are ordered by vscID.

func (Keeper) GetAllPendingPacketsWithIdx added in v3.2.0

func (k Keeper) GetAllPendingPacketsWithIdx(ctx sdk.Context) []ConsumerPacketDataWithIdx

GetAllPendingPacketsWithIdx returns ALL pending consumer packet data from the store with indexes relevant to the pending packets queue.

func (Keeper) GetAllValidators

func (k Keeper) GetAllValidators(ctx sdk.Context) []stakingtypes.Validator

GetAllValidators is needed to implement StakingKeeper as expected by the Slashing module since cosmos-sdk/v0.47.x. Use GetAllCCValidator in places where access to all cross-chain validators is needed.

func (Keeper) GetBlocksPerDistributionTransmission

func (k Keeper) GetBlocksPerDistributionTransmission(ctx sdk.Context) int64

func (Keeper) GetCCVTimeoutPeriod

func (k Keeper) GetCCVTimeoutPeriod(ctx sdk.Context) time.Duration

GetCCVTimeoutPeriod returns the timeout period for sent ccv related ibc packets

func (Keeper) GetCCValidator

func (k Keeper) GetCCValidator(ctx sdk.Context, addr []byte) (validator types.CrossChainValidator, found bool)

GetCCValidator returns a cross-chain validator for a given address

func (Keeper) GetConnectionHops

func (k Keeper) GetConnectionHops(ctx sdk.Context, srcPort, srcChan string) ([]string, error)

func (Keeper) GetConsumerParams

func (k Keeper) GetConsumerParams(ctx sdk.Context) ccvtypes.ConsumerParams

GetParams returns the params for the consumer ccv module NOTE: it is different from the GetParams method which is required to implement StakingKeeper interface

func (Keeper) GetConsumerRedistributionFrac

func (k Keeper) GetConsumerRedistributionFrac(ctx sdk.Context) string

GetConsumerRedistributionFrac returns the fraction of tokens allocated to the consumer redistribution address during distribution events. The fraction is a string representing a decimal number. For example "0.75" would represent 75%.

func (Keeper) GetDistributionTransmissionChannel

func (k Keeper) GetDistributionTransmissionChannel(ctx sdk.Context) string

func (Keeper) GetElapsedPacketMaturityTimes

func (k Keeper) GetElapsedPacketMaturityTimes(ctx sdk.Context) (maturingVSCPackets []types.MaturingVSCPacket)

GetElapsedPacketMaturityTimes returns a slice of already elapsed PacketMaturityTimes, sorted by maturity times, i.e., the slice contains the IDs of the matured VSCPackets.

func (Keeper) GetEnabled

func (k Keeper) GetEnabled(ctx sdk.Context) bool

GetEnabled returns the enabled flag for the consumer module

func (Keeper) GetEstimatedNextFeeDistribution

func (k Keeper) GetEstimatedNextFeeDistribution(ctx sdk.Context) types.NextFeeDistributionEstimate

GetEstimatedNextFeeDistribution returns data about next fee distribution. Data represents an estimation of accumulated fees at the current block height.

func (Keeper) GetHeightValsetUpdateID

func (k Keeper) GetHeightValsetUpdateID(ctx sdk.Context, height uint64) uint64

GetHeightValsetUpdateID gets the valset update id recorded for a given block height

func (Keeper) GetHistoricalEntries

func (k Keeper) GetHistoricalEntries(ctx sdk.Context) int64

GetHistoricalEntries returns the number of historical info entries to persist in store

func (Keeper) GetHistoricalInfo

func (k Keeper) GetHistoricalInfo(ctx sdk.Context, height int64) (stakingtypes.HistoricalInfo, bool)

GetHistoricalInfo gets the historical info at a given height

func (Keeper) GetInitGenesisHeight

func (k Keeper) GetInitGenesisHeight(ctx sdk.Context) int64

func (Keeper) GetInitialValSet

func (k Keeper) GetInitialValSet(ctx sdk.Context) []tmtypes.ValidatorUpdate

func (Keeper) GetLastStandaloneValidators

func (k Keeper) GetLastStandaloneValidators(ctx sdk.Context) []stakingtypes.Validator

func (Keeper) GetLastTransmissionBlockHeight

func (k Keeper) GetLastTransmissionBlockHeight(ctx sdk.Context) types.LastTransmissionBlockHeight

func (Keeper) GetParams

func (k Keeper) GetParams(ctx sdk.Context) stakingtypes.Params

GetParams implements StakingKeeper GetParams interface method it returns an a empty stakingtypes.Params struct NOTE: this method must be implemented on the consumer keeper because the evidence module keeper in cosmos-sdk v0.47 requires this exact method with this exact signature to be available on the StakingKeepr

func (Keeper) GetPendingChanges

func (k Keeper) GetPendingChanges(ctx sdk.Context) (*ccv.ValidatorSetChangePacketData, bool)

GetPendingChanges gets the pending changes that haven't been flushed over ABCI

func (Keeper) GetPendingPackets

func (k Keeper) GetPendingPackets(ctx sdk.Context) []ccv.ConsumerPacketData

GetPendingPackets returns ALL the pending CCV packets from the store without indexes.

func (Keeper) GetPort

func (k Keeper) GetPort(ctx sdk.Context) string

GetPort returns the portID for the transfer module. Used in ExportGenesis

func (Keeper) GetProviderChannel

func (k Keeper) GetProviderChannel(ctx sdk.Context) (string, bool)

GetProviderChannel gets the channelID for the channel to the provider.

func (Keeper) GetProviderClientID

func (k Keeper) GetProviderClientID(ctx sdk.Context) (string, bool)

GetProviderClientID gets the clientID for the client to the provider.

func (Keeper) GetProviderFeePoolAddrStr

func (k Keeper) GetProviderFeePoolAddrStr(ctx sdk.Context) string

func (Keeper) GetProviderInfo added in v3.2.0

func (k Keeper) GetProviderInfo(ctx sdk.Context) (*types.QueryProviderInfoResponse, error)

func (Keeper) GetProviderRewardDenoms

func (k Keeper) GetProviderRewardDenoms(ctx sdk.Context) []string

func (Keeper) GetRewardDenoms

func (k Keeper) GetRewardDenoms(ctx sdk.Context) []string

func (Keeper) GetSlashRecord added in v3.2.0

func (k Keeper) GetSlashRecord(ctx sdktypes.Context) (record consumertypes.SlashRecord, found bool)

func (Keeper) GetSmallestNonOptOutPower

func (k Keeper) GetSmallestNonOptOutPower(ctx sdk.Context) int64

GetSmallestNonOptOutPower returns the smallest validator power that cannot soft opt out.

func (Keeper) GetSoftOptOutThreshold

func (k Keeper) GetSoftOptOutThreshold(ctx sdk.Context) string

GetSoftOptOutThreshold returns the percentage of validators at the bottom of the set that can opt out of running the consumer chain

func (Keeper) GetTransferTimeoutPeriod

func (k Keeper) GetTransferTimeoutPeriod(ctx sdk.Context) time.Duration

GetTransferTimeoutPeriod returns the timeout period for sent transfer related ibc packets

func (Keeper) GetUnbondingPeriod

func (k Keeper) GetUnbondingPeriod(ctx sdk.Context) time.Duration

func (Keeper) Hooks

func (k Keeper) Hooks() Hooks

Return the wrapper struct

func (Keeper) InitGenesis

func (k Keeper) InitGenesis(ctx sdk.Context, state *types.GenesisState) []abci.ValidatorUpdate

InitGenesis initializes the CCV consumer state and binds to PortID. The three states in which a consumer chain can start/restart:

  1. A client to the provider was never created, i.e. a new consumer chain is started for the first time.
  2. A consumer chain restarts after a client to the provider was created, but the CCV channel handshake is still in progress
  3. A consumer chain restarts after the CCV channel handshake was completed.

func (Keeper) IsBound

func (k Keeper) IsBound(ctx sdk.Context, portID string) bool

IsBound checks if the transfer module is already bound to the desired port

func (Keeper) IsChannelClosed

func (k Keeper) IsChannelClosed(ctx sdk.Context, channelID string) bool

IsChannelClosed returns a boolean whether a given channel is in the CLOSED state

func (Keeper) IsPreCCV

func (k Keeper) IsPreCCV(ctx sdk.Context) bool

func (Keeper) IsPrevStandaloneChain

func (k Keeper) IsPrevStandaloneChain(ctx sdk.Context) bool

func (Keeper) IsValidatorJailed

func (k Keeper) IsValidatorJailed(ctx sdk.Context, addr sdk.ConsAddress) bool

IsJailed returns the outstanding slashing flag for the given validator adddress

func (Keeper) IterateValidators

func (k Keeper) IterateValidators(sdk.Context, func(index int64, validator stakingtypes.ValidatorI) (stop bool))

IterateValidators - unimplemented on CCV keeper but perform a no-op in order to pass the slashing module InitGenesis. It is allowed since the condition verifying validator public keys in HandleValidatorSignature (x/slashing/keeper/infractions.go) is removed therefore it isn't required to store any validator public keys to the slashing states during genesis.

func (Keeper) Jail

func (k Keeper) Jail(ctx sdk.Context, addr sdk.ConsAddress)

Jail - unimplemented on CCV keeper

This method should be a no-op even during a standalone to consumer changeover. Once the upgrade has happened as a part of the changeover, the provider validator set will soon be in effect, and jailing is n/a.

func (Keeper) Logger

func (k Keeper) Logger(ctx sdk.Context) log.Logger

Logger returns a module-specific logger.

func (Keeper) MarkAsPrevStandaloneChain

func (k Keeper) MarkAsPrevStandaloneChain(ctx sdk.Context)

func (Keeper) MaxValidators

func (k Keeper) MaxValidators(sdk.Context) uint32

MaxValidators - unimplemented on CCV keeper

func (Keeper) MigrateConsumerPacketData added in v3.2.0

func (k Keeper) MigrateConsumerPacketData(ctx sdk.Context) error

MigrateConsumerPacketData migrates consumer packet data according to https://github.com/cosmos/interchain-security/pull/1037

Note an equivalent migration is not required for providers.

func (Keeper) MustGetCurrentValidatorsAsABCIUpdates

func (k Keeper) MustGetCurrentValidatorsAsABCIUpdates(ctx sdk.Context) []abci.ValidatorUpdate

MustGetCurrentValidatorsAsABCIUpdates gets all cross-chain validators converted to the ABCI validator update type. It panics in case of failure.

func (Keeper) OnAcknowledgementPacket

func (k Keeper) OnAcknowledgementPacket(ctx sdk.Context, packet channeltypes.Packet, ack channeltypes.Acknowledgement) error

OnAcknowledgementPacket executes application logic for acknowledgments of sent VSCMatured and Slash packets in conjunction with the ibc module's execution of "acknowledgePacket", according to https://github.com/cosmos/ibc/tree/main/spec/core/ics-004-channel-and-packet-semantics#processing-acknowledgements

func (Keeper) OnRecvVSCPacket

func (k Keeper) OnRecvVSCPacket(ctx sdk.Context, packet channeltypes.Packet, newChanges ccv.ValidatorSetChangePacketData) error

OnRecvVSCPacket sets the pending validator set changes that will be flushed to ABCI on Endblock and set the maturity time for the packet. Once the maturity time elapses, a VSCMatured packet is sent back to the provider chain.

Note: CCV uses an ordered IBC channel, meaning VSC packet changes will be accumulated (and later processed by ApplyCCValidatorChanges) s.t. more recent val power changes overwrite older ones.

func (Keeper) OutstandingDowntime

func (k Keeper) OutstandingDowntime(ctx sdk.Context, address sdk.ConsAddress) bool

OutstandingDowntime returns the outstanding downtime flag for a given validator

func (Keeper) PacketMaturityTimeExists

func (k Keeper) PacketMaturityTimeExists(ctx sdk.Context, vscId uint64, maturityTime time.Time) bool

PacketMaturityExists checks whether the packet maturity time for a given vscId and maturityTime exists.

Note: this method is only used in testing.

func (Keeper) PacketSendingPermitted added in v3.2.0

func (k Keeper) PacketSendingPermitted(ctx sdktypes.Context) bool

PacketSendingPermitted returns whether the consumer is allowed to send packets from the pending packets queue.

func (Keeper) QueryParams

func (Keeper) QueryProviderInfo added in v3.2.0

func (Keeper) QueueSlashPacket

func (k Keeper) QueueSlashPacket(ctx sdk.Context, validator abci.Validator, valsetUpdateID uint64, infraction stakingtypes.Infraction)

QueueSlashPacket appends a slash packet containing the given validator data and slashing info to queue.

func (Keeper) QueueVSCMaturedPackets

func (k Keeper) QueueVSCMaturedPackets(ctx sdk.Context)

QueueVSCMaturedPackets appends matured VSCs to an internal queue.

Note: Per spec, a VSC reaching maturity on a consumer chain means that all the unbonding operations that resulted in validator updates included in that VSC have matured on the consumer chain.

func (Keeper) SendPackets

func (k Keeper) SendPackets(ctx sdk.Context)

SendPackets iterates queued packets and sends them in FIFO order. received VSC packets in order, and write acknowledgements for all matured VSC packets.

This method is a no-op if there is no established channel to provider or the queue is empty.

Note: Per spec, a VSC reaching maturity on a consumer chain means that all the unbonding operations that resulted in validator updates included in that VSC have matured on the consumer chain.

func (Keeper) SendRewardsToProvider

func (k Keeper) SendRewardsToProvider(ctx sdk.Context) error

SendRewardsToProvider attempts to send to the provider (via IBC) all the block rewards allocated for the provider

func (Keeper) SetBlocksPerDistributionTransmission

func (k Keeper) SetBlocksPerDistributionTransmission(ctx sdk.Context, bpdt int64)

func (Keeper) SetCCValidator

func (k Keeper) SetCCValidator(ctx sdk.Context, v types.CrossChainValidator)

SetCCValidator sets a cross-chain validator under its validator address

func (Keeper) SetDistributionTransmissionChannel

func (k Keeper) SetDistributionTransmissionChannel(ctx sdk.Context, channel string)

func (Keeper) SetHeightValsetUpdateID

func (k Keeper) SetHeightValsetUpdateID(ctx sdk.Context, height, valsetUpdateId uint64)

SetHeightValsetUpdateID sets the valset update id for a given block height

func (Keeper) SetHistoricalInfo

func (k Keeper) SetHistoricalInfo(ctx sdk.Context, height int64, hi *stakingtypes.HistoricalInfo)

SetHistoricalInfo sets the historical info at a given height

func (*Keeper) SetHooks

func (k *Keeper) SetHooks(sh ccv.ConsumerHooks) *Keeper

func (Keeper) SetInitGenesisHeight

func (k Keeper) SetInitGenesisHeight(ctx sdk.Context, height int64)

func (Keeper) SetInitialValSet

func (k Keeper) SetInitialValSet(ctx sdk.Context, initialValSet []tmtypes.ValidatorUpdate)

func (Keeper) SetLastTransmissionBlockHeight

func (k Keeper) SetLastTransmissionBlockHeight(ctx sdk.Context, ltbh types.LastTransmissionBlockHeight)

func (Keeper) SetOutstandingDowntime

func (k Keeper) SetOutstandingDowntime(ctx sdk.Context, address sdk.ConsAddress)

SetOutstandingDowntime sets the outstanding downtime flag for a given validator

func (Keeper) SetPacketMaturityTime

func (k Keeper) SetPacketMaturityTime(ctx sdk.Context, vscId uint64, maturityTime time.Time)

SetPacketMaturityTime sets the maturity time for a given received VSC packet id

func (*Keeper) SetParamSpace

func (k *Keeper) SetParamSpace(ctx sdk.Context, ps paramtypes.Subspace)

SetParamSpace sets the param space for the consumer keeper. Note: this is only used for testing!

func (Keeper) SetParams

func (k Keeper) SetParams(ctx sdk.Context, params ccvtypes.ConsumerParams)

SetParams sets the paramset for the consumer module

func (Keeper) SetPendingChanges

func (k Keeper) SetPendingChanges(ctx sdk.Context, updates ccv.ValidatorSetChangePacketData)

SetPendingChanges sets the pending validator set change packet that haven't been flushed to ABCI

func (Keeper) SetPendingPacketsOnlyForTesting added in v3.2.0

func (k Keeper) SetPendingPacketsOnlyForTesting(ctx sdk.Context, packets consumertypes.ConsumerPacketDataList)

Note: a better test of the old functionality would be to directly reference the old ICS version, including the version of ccv.ConsumerPacketDataList has a list of ccv.ConsumerPacketData without indexes.

func (Keeper) SetPort

func (k Keeper) SetPort(ctx sdk.Context, portID string)

SetPort sets the portID for the CCV module. Used in InitGenesis

func (Keeper) SetPreCCVTrue

func (k Keeper) SetPreCCVTrue(ctx sdk.Context)

func (Keeper) SetProviderChannel

func (k Keeper) SetProviderChannel(ctx sdk.Context, channelID string)

SetProviderChannel sets the channelID for the channel to the provider.

func (Keeper) SetProviderClientID

func (k Keeper) SetProviderClientID(ctx sdk.Context, clientID string)

SetProviderClientID sets the clientID for the client to the provider. Set in InitGenesis

func (Keeper) SetProviderFeePoolAddrStr

func (k Keeper) SetProviderFeePoolAddrStr(ctx sdk.Context, addr string)

func (Keeper) SetSlashRecord added in v3.2.0

func (k Keeper) SetSlashRecord(ctx sdktypes.Context, record consumertypes.SlashRecord)

func (Keeper) SetSmallestNonOptOutPower

func (k Keeper) SetSmallestNonOptOutPower(ctx sdk.Context, power uint64)

SetSmallestNonOptOutPower sets the smallest validator power that cannot soft opt out.

func (*Keeper) SetStandaloneStakingKeeper

func (k *Keeper) SetStandaloneStakingKeeper(sk ccv.StakingKeeper)

SetStandaloneStakingKeeper sets the standalone staking keeper for the consumer chain. This method should only be called for previously standalone chains that are now consumers.

func (Keeper) SetUnbondingPeriod

func (k Keeper) SetUnbondingPeriod(ctx sdk.Context, period time.Duration)

Only used to set an unbonding period in diff tests

func (Keeper) Slash

func (k Keeper) Slash(ctx sdk.Context, addr sdk.ConsAddress, infractionHeight, power int64, slashFactor sdk.Dec) math.Int

Calls SlashWithInfractionReason with Infraction_INFRACTION_UNSPECIFIED. ConsumerKeeper must implement StakingKeeper interface. This function should not be called anywhere

func (Keeper) SlashWithInfractionReason

func (k Keeper) SlashWithInfractionReason(ctx sdk.Context, addr sdk.ConsAddress, infractionHeight, power int64, slashFactor sdk.Dec, infraction stakingtypes.Infraction) math.Int

Slash queues a slashing request for the the provider chain All queued slashing requests will be cleared in EndBlock Called by Slashing keeper in SlashWithInfractionReason

func (Keeper) TrackHistoricalInfo

func (k Keeper) TrackHistoricalInfo(ctx sdk.Context)

TrackHistoricalInfo saves the latest historical-info and deletes the oldest heights that are below pruning height

func (Keeper) TransferChannelExists

func (k Keeper) TransferChannelExists(ctx sdk.Context, channelID string) bool

func (Keeper) UnbondingTime

func (k Keeper) UnbondingTime(ctx sdk.Context) time.Duration

UnbondingTime returns consumer unbonding period, satisfying the staking keeper interface

func (Keeper) Unjail

func (k Keeper) Unjail(sdk.Context, sdk.ConsAddress)

Unjail - unimplemented on CCV keeper

This method should be a no-op even during a standalone to consumer changeover. Once the upgrade has happened as a part of the changeover, the provider validator set will soon be in effect, and jailing is n/a.

func (Keeper) UpdateSlashRecordOnBounce added in v3.2.0

func (k Keeper) UpdateSlashRecordOnBounce(ctx sdktypes.Context)

func (Keeper) UpdateSlashRecordOnSend added in v3.2.0

func (k Keeper) UpdateSlashRecordOnSend(ctx sdktypes.Context)

func (Keeper) UpdateSmallestNonOptOutPower

func (k Keeper) UpdateSmallestNonOptOutPower(ctx sdk.Context)

UpdateSmallestNonOptOutPower updates the smallest validator power that cannot soft opt out. This is the smallest validator power such that the sum of the power of all validators with a lower power is less than [SoftOptOutThreshold] of the total power of all validators.

func (Keeper) Validator

func (k Keeper) Validator(ctx sdk.Context, addr sdk.ValAddress) stakingtypes.ValidatorI

Validator - unimplemented on CCV keeper

func (Keeper) ValidatorByConsAddr

func (k Keeper) ValidatorByConsAddr(sdk.Context, sdk.ConsAddress) stakingtypes.ValidatorI

ValidatorByConsAddr returns an empty validator

func (Keeper) VerifyProviderChain

func (k Keeper) VerifyProviderChain(ctx sdk.Context, connectionHops []string) error

VerifyProviderChain verifies that the chain trying to connect on the channel handshake is the expected provider chain.

type Migrator added in v3.2.0

type Migrator struct {
	// contains filtered or unexported fields
}

Migrator is a struct for handling in-place store migrations.

func NewMigrator added in v3.2.0

func NewMigrator(ccvConsumerKeeper Keeper, ccvConsumerParamSpace paramtypes.Subspace) Migrator

NewMigrator returns a new Migrator.

func (Migrator) Migrate1to2 added in v3.2.0

func (m Migrator) Migrate1to2(ctx sdk.Context) error

Migrate1to2 migrates x/ccvconsumer state from consensus version 1 to 2.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL