keeper

package
v2.0.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2023 License: Apache-2.0 Imports: 30 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MigrateConsumerGenesisStatesv1Tov2

func MigrateConsumerGenesisStatesv1Tov2(ctx sdk.Context, providerKeeper Keeper)

func MigrateKeysv1Tov2

func MigrateKeysv1Tov2(ctx sdk.Context, providerKeeper Keeper)

Due to https://github.com/cosmos/interchain-security/pull/786, validators' slash logs are stored under the key prefix for slash acks. This method will extract "slash logs" from the slash acks part of the store, and put the slash logs in their appropriate store location.

func MigrateParamsv1Tov2

func MigrateParamsv1Tov2(ctx sdk.Context, paramsSubspace paramtypes.Subspace, consumerRewardDenomRegistrationFee sdk.Coin)

MigrateParamsv1Tov2 migrates the provider CCV module params from v1.0.0 to v2.0.0, setting default values for new params.

func NewMsgServerImpl

func NewMsgServerImpl(keeper *Keeper) types.MsgServer

NewMsgServerImpl returns an implementation of the bank MsgServer interface for the provided Keeper.

func SlashLogKeyOnlyForTesting

func SlashLogKeyOnlyForTesting(providerAddr sdk.ConsAddress) []byte

LEGACY METHOD USED FOR TESTING MIGRATION ONLY. DO NOT USE! This method is copy/pasted from ICS v1.0.0.

func ValidatorConsensusKeyInUse

func ValidatorConsensusKeyInUse(k *Keeper, ctx sdk.Context, valAddr sdk.ValAddress) bool

ValidatorConsensusKeyInUse is called when a new validator is created in the x/staking module of cosmos-sdk. In case it panics, the TX aborts and thus, the validator is not created. See AfterValidatorCreated hook.

Types

type Hooks

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

Wrapper struct

func (Hooks) AfterDelegationModified

func (h Hooks) AfterDelegationModified(_ sdk.Context, _ sdk.AccAddress, _ sdk.ValAddress)

func (Hooks) AfterUnbondingInitiated

func (h Hooks) AfterUnbondingInitiated(ctx sdk.Context, id uint64) error

This stores a record of each unbonding op from staking, allowing us to track which consumer chains have unbonded

func (Hooks) AfterValidatorBeginUnbonding

func (h Hooks) AfterValidatorBeginUnbonding(_ sdk.Context, _ sdk.ConsAddress, _ sdk.ValAddress)

func (Hooks) AfterValidatorBonded

func (h Hooks) AfterValidatorBonded(_ sdk.Context, _ sdk.ConsAddress, _ sdk.ValAddress)

func (Hooks) AfterValidatorCreated

func (h Hooks) AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress)

func (Hooks) AfterValidatorRemoved

func (h Hooks) AfterValidatorRemoved(ctx sdk.Context, valConsAddr sdk.ConsAddress, valAddr sdk.ValAddress)

func (Hooks) BeforeDelegationCreated

func (h Hooks) BeforeDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)

func (Hooks) BeforeDelegationRemoved

func (h Hooks) BeforeDelegationRemoved(_ sdk.Context, _ sdk.AccAddress, _ sdk.ValAddress)

func (Hooks) BeforeDelegationSharesModified

func (h Hooks) BeforeDelegationSharesModified(_ sdk.Context, _ sdk.AccAddress, _ sdk.ValAddress)

func (Hooks) BeforeValidatorModified

func (h Hooks) BeforeValidatorModified(_ sdk.Context, _ sdk.ValAddress)

func (Hooks) BeforeValidatorSlashed

func (h Hooks) BeforeValidatorSlashed(_ sdk.Context, _ sdk.ValAddress, _ sdk.Dec)

type Keeper

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

Keeper defines the Cross-Chain Validation Provider Keeper

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec, key sdk.StoreKey, paramSpace paramtypes.Subspace, scopedKeeper ccv.ScopedKeeper,
	channelKeeper ccv.ChannelKeeper, portKeeper ccv.PortKeeper,
	connectionKeeper ccv.ConnectionKeeper, clientKeeper ccv.ClientKeeper,
	stakingKeeper ccv.StakingKeeper, slashingKeeper ccv.SlashingKeeper,
	accountKeeper ccv.AccountKeeper, evidenceKeeper ccv.EvidenceKeeper,
	distributionKeeper ccv.DistributionKeeper, bankKeeper ccv.BankKeeper,
	feeCollectorName string,
) Keeper

NewKeeper creates a new provider Keeper instance

func (Keeper) AppendConsumerAddrsToPrune

func (k Keeper) AppendConsumerAddrsToPrune(ctx sdk.Context, chainID string, vscID uint64, consumerAddr types.ConsumerConsAddress)

AppendConsumerAddrsToPrune appends a consumer validator address to the list of consumer addresses that can be pruned once the VSCMaturedPacket with vscID is received.

The following invariant needs to hold: For each consumer address cAddr in ValidatorByConsumerAddr,

  • either there exists a provider address pAddr in ValidatorConsumerPubKey, s.t. hash(ValidatorConsumerPubKey(pAddr)) = cAddr
  • or there exists a vscID in ConsumerAddrsToPrune s.t. cAddr in ConsumerAddrsToPrune(vscID)

func (Keeper) AppendMaturedUnbondingOps

func (k Keeper) AppendMaturedUnbondingOps(ctx sdk.Context, ids []uint64)

AppendMaturedUnbondingOps adds a list of ids to the list of matured unbonding operation ids

func (Keeper) AppendPendingVSCPackets

func (k Keeper) AppendPendingVSCPackets(ctx sdk.Context, chainID string, newPackets ...ccv.ValidatorSetChangePacketData)

AppendPendingVSCPackets adds the given ValidatorSetChange packet to the list of pending ValidatorSetChange packets stored under chain ID

func (Keeper) AppendSlashAck

func (k Keeper) AppendSlashAck(ctx sdk.Context, chainID,
	ack string,
)

AppendSlashAck appends the given slash ack to the given chain ID slash acks in store

func (Keeper) AssignConsumerKey

func (k Keeper) AssignConsumerKey(
	ctx sdk.Context,
	chainID string,
	validator stakingtypes.Validator,
	consumerKey tmprotocrypto.PublicKey,
) error

AssignConsumerKey assigns the consumerKey to the validator with providerAddr on the consumer chain with ID chainID

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) BeginBlockCCR

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

BeginBlockCCR iterates over the pending consumer removal proposals in order and stop/removes the chain if the stop time has passed, otherwise it will break out of loop and return. Executed proposals are deleted.

See: https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/methods.md#ccv-pcf-bblock-ccr1 Spec tag: [CCV-PCF-BBLOCK-CCR.1]

func (Keeper) BeginBlockInit

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

BeginBlockInit iterates over the pending consumer addition proposals in order, and creates clients for props in which the spawn time has passed. Executed proposals are deleted.

See: https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/methods.md#ccv-pcf-bblock-init1 Spec tag:[CCV-PCF-BBLOCK-INIT.1]

func (Keeper) BindPort

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

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

func (Keeper) BondDenom

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

func (Keeper) CheckForSlashMeterReplenishment

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

CheckForSlashMeterReplenishment checks if the slash meter should be replenished, and if so, replenishes it. Note: initial slash meter replenish time candidate is set in InitGenesis.

func (Keeper) ClaimCapability

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

ClaimCapability allows the transfer module that can claim a capability that IBC module passes to it

func (Keeper) ConsumeMaturedUnbondingOps

func (k Keeper) ConsumeMaturedUnbondingOps(ctx sdk.Context) []uint64

ConsumeMaturedUnbondingOps empties and returns list of matured unbonding operation ids (if it exists)

func (Keeper) ConsumeSlashAcks

func (k Keeper) ConsumeSlashAcks(ctx sdk.Context, chainID string) (acks []string)

ConsumeSlashAcks empties and returns the slash acks for a given chain ID

func (Keeper) ConsumerRewardDenomExists

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

func (Keeper) CreateConsumerClient

func (k Keeper) CreateConsumerClient(ctx sdk.Context, prop *types.ConsumerAdditionProposal) error

CreateConsumerClient will create the CCV client for the given consumer chain. The CCV channel must be built on top of the CCV client to ensure connection with the right consumer chain.

See: https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/methods.md#ccv-pcf-crclient1 Spec tag: [CCV-PCF-CRCLIENT.1]

func (Keeper) CreateConsumerClientInCachedCtx

func (k Keeper) CreateConsumerClientInCachedCtx(ctx sdk.Context, p types.ConsumerAdditionProposal) (cc sdk.Context, writeCache func(), err error)

CreateConsumerClientInCachedCtx creates a consumer client from a given consumer addition proposal in a cached context

func (Keeper) DeleteChainToChannel

func (k Keeper) DeleteChainToChannel(ctx sdk.Context, chainID string)

DeleteChainToChannel deletes the CCV channel ID for the given consumer chain ID

func (Keeper) DeleteChannelToChain

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

DeleteChannelToChain deletes the consumer chain ID for a given CCV channelID

func (Keeper) DeleteConsumerAddrsToPrune

func (k Keeper) DeleteConsumerAddrsToPrune(ctx sdk.Context, chainID string, vscID uint64)

DeleteConsumerAddrsToPrune deletes the list of consumer addresses mapped to a given VSC ID

func (Keeper) DeleteConsumerClientId

func (k Keeper) DeleteConsumerClientId(ctx sdk.Context, chainID string)

DeleteConsumerClientId removes from the store the clientID for the given chainID.

func (Keeper) DeleteConsumerGenesis

func (k Keeper) DeleteConsumerGenesis(ctx sdk.Context, chainID string)

func (Keeper) DeleteGlobalSlashEntries

func (k Keeper) DeleteGlobalSlashEntries(ctx sdktypes.Context, entries ...providertypes.GlobalSlashEntry)

DeleteGlobalSlashEntries deletes the given global entries from the global slash queue

func (Keeper) DeleteGlobalSlashEntriesForConsumer

func (k Keeper) DeleteGlobalSlashEntriesForConsumer(ctx sdktypes.Context, consumerChainID string)

DeleteGlobalSlashEntriesForConsumer deletes all pending slash packet entries in the global queue, only relevant to a single consumer.

func (Keeper) DeleteInitChainHeight

func (k Keeper) DeleteInitChainHeight(ctx sdk.Context, chainID string)

DeleteInitChainHeight deletes the block height value for which the given consumer chain's channel was established

func (Keeper) DeleteInitTimeoutTimestamp

func (k Keeper) DeleteInitTimeoutTimestamp(ctx sdk.Context, chainID string)

DeleteInitTimeoutTimestamp removes from the store the init timeout timestamp for the given chainID.

func (Keeper) DeleteKeyAssignmentReplacement

func (k Keeper) DeleteKeyAssignmentReplacement(ctx sdk.Context, chainID string, providerAddr types.ProviderConsAddress)

DeleteKeyAssignmentReplacement deletes the previous assigned consumer key and the current power for a provider validator for which a key assignment was received in this block. Both are needed to update the validator's power on the consumer chain at the end of the current block.

func (Keeper) DeleteKeyAssignments

func (k Keeper) DeleteKeyAssignments(ctx sdk.Context, chainID string)

DeleteKeyAssignments deletes all the state needed for key assignments on a consumer chain

func (Keeper) DeletePendingConsumerAdditionProps

func (k Keeper) DeletePendingConsumerAdditionProps(ctx sdk.Context, proposals ...types.ConsumerAdditionProposal)

DeletePendingConsumerAdditionProps deletes the given consumer addition proposals

func (Keeper) DeletePendingConsumerRemovalProps

func (k Keeper) DeletePendingConsumerRemovalProps(ctx sdk.Context, proposals ...types.ConsumerRemovalProposal)

DeletePendingConsumerRemovalProps deletes the given pending consumer removal proposals. This method should be called once the proposal has been acted upon.

func (Keeper) DeletePendingVSCPackets

func (k Keeper) DeletePendingVSCPackets(ctx sdk.Context, chainID string)

DeletePendingVSCPackets deletes the list of pending ValidatorSetChange packets for chain ID

func (Keeper) DeleteSlashAcks

func (k Keeper) DeleteSlashAcks(ctx sdk.Context, chainID string)

DeleteSlashAcks deletes the slash acks for a given chain ID

func (Keeper) DeleteThrottledPacketData

func (k Keeper) DeleteThrottledPacketData(ctx sdktypes.Context, consumerChainID string, ibcSeqNumbers ...uint64)

DeleteThrottledPacketData deletes the given throttled packet data instances (specified by their ibc seq number) from the chain-specific throttled packet data queue.

func (Keeper) DeleteThrottledPacketDataForConsumer

func (k Keeper) DeleteThrottledPacketDataForConsumer(ctx sdktypes.Context, consumerChainID string)

DeleteAllPacketDataForConsumer deletes all queued packet data for the given consumer chain.

func (Keeper) DeleteUnbondingOp

func (k Keeper) DeleteUnbondingOp(ctx sdk.Context, id uint64)

DeleteUnbondingOp deletes a UnbondingOp given its ID

func (Keeper) DeleteUnbondingOpIndex

func (k Keeper) DeleteUnbondingOpIndex(ctx sdk.Context, chainID string, vscID uint64)

DeleteUnbondingOpIndex deletes the IDs of unbonding operations that are waiting for a VSCMaturedPacket with vscID from a consumer with chainID

func (Keeper) DeleteValidatorByConsumerAddr

func (k Keeper) DeleteValidatorByConsumerAddr(ctx sdk.Context, chainID string, consumerAddr types.ConsumerConsAddress)

DeleteValidatorByConsumerAddr deletes the mapping from a validator's consensus address on a consumer to the validator's consensus address on the provider

func (Keeper) DeleteValidatorConsumerPubKey

func (k Keeper) DeleteValidatorConsumerPubKey(ctx sdk.Context, chainID string, providerAddr types.ProviderConsAddress)

DeleteValidatorConsumerPubKey deletes a validator's public key assigned for a consumer chain

func (Keeper) DeleteValsetUpdateBlockHeight

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

DeleteValsetUpdateBlockHeight deletes the block height value for a given vaset update id

func (Keeper) DeleteVscSendTimestamp

func (k Keeper) DeleteVscSendTimestamp(ctx sdk.Context, chainID string, vscID uint64)

DeleteVscSendTimestamp removes from the store a specific VSC send timestamp for the given chainID and vscID.

func (Keeper) DeleteVscSendTimestampsForConsumer

func (k Keeper) DeleteVscSendTimestampsForConsumer(ctx sdk.Context, consumerChainID string)

DeleteVscSendTimestampsForConsumer deletes all VSC send timestamps for a given consumer chain

func (Keeper) EndBlockCCR

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

EndBlockCCR contains the EndBlock logic needed for the Consumer Chain Removal sub-protocol

func (Keeper) EndBlockCIS

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

EndBlockCIS contains the EndBlock logic needed for the Consumer Initiated Slashing sub-protocol

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 ConsumerRewardsPool, from where they sent to the fee collector address

func (Keeper) EndBlockVSU

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

EndBlockVSU contains the EndBlock logic needed for the Validator Set Update sub-protocol

func (Keeper) ExportGenesis

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

ExportGenesis returns the CCV provider module's exported genesis

func (Keeper) GetAllChannelToChains

func (k Keeper) GetAllChannelToChains(ctx sdk.Context) (channels []types.ChannelToChain)

GetAllChannelToChains gets all channel to chain mappings. If a mapping exists, then the CCV channel to that consumer chain is established.

Note that mapping from CCV channel IDs to consumer chainIDs is stored under keys with the following format: ChannelToChainBytePrefix | channelID Thus, the returned array is in ascending order of channelIDs.

func (Keeper) GetAllConsumerAddrsToPrune

func (k Keeper) GetAllConsumerAddrsToPrune(ctx sdk.Context, chainID string) (consumerAddrsToPrune []types.ConsumerAddrsToPrune)

GetAllConsumerAddrsToPrune gets all consumer addresses that can be pruned for a given chainID.

Note that the list of all consumer addresses is stored under keys with the following format: ConsumerAddrsToPruneBytePrefix | len(chainID) | chainID | vscID Thus, the returned array is in ascending order of vscIDs.

func (Keeper) GetAllConsumerChains

func (k Keeper) GetAllConsumerChains(ctx sdk.Context) (chains []types.Chain)

GetAllConsumerChains gets all of the consumer chains, for which the provider module created IBC clients. Consumer chains with created clients are also referred to as registered.

Note that the registered consumer chains are stored under keys with the following format: ChainToClientBytePrefix | chainID Thus, the returned array is in ascending order of chainIDs.

func (Keeper) GetAllConsumerRewardDenoms

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

func (Keeper) GetAllGlobalSlashEntries

func (k Keeper) GetAllGlobalSlashEntries(ctx sdktypes.Context) []providertypes.GlobalSlashEntry

GetAllGlobalSlashEntries returns all global slash entries from the queue.

Note global slash entries are stored under keys with the following format: GlobalSlashEntryBytePrefix | uint64 recv time | ibc seq num | consumer chain id Thus, the returned array is ordered by recv time, then ibc seq num.

func (Keeper) GetAllInitTimeoutTimestamps

func (k Keeper) GetAllInitTimeoutTimestamps(ctx sdk.Context) (initTimeoutTimestamps []types.InitTimeoutTimestamp)

GetAllInitTimeoutTimestamps gets all init timeout timestamps in the store.

Note that the init timeout timestamps are stored under keys with the following format: InitTimeoutTimestampBytePrefix | chainID Thus, the returned array is in ascending order of chainIDs (NOT in timestamp order).

func (Keeper) GetAllKeyAssignmentReplacements

func (k Keeper) GetAllKeyAssignmentReplacements(ctx sdk.Context, chainID string) (replacements []types.KeyAssignmentReplacement)

GetAllKeyAssignmentReplacements gets all pairs of previous assigned consumer keys and current powers for all provider validator for which key assignments were received in this block.

Note that the pairs are stored under keys with the following format: KeyAssignmentReplacementsBytePrefix | len(chainID) | chainID | providerAddress Thus, the iteration is in ascending order of providerAddresses.

func (Keeper) GetAllPendingConsumerAdditionProps

func (k Keeper) GetAllPendingConsumerAdditionProps(ctx sdk.Context) (props []types.ConsumerAdditionProposal)

GetAllPendingConsumerAdditionProps gets all pending consumer addition proposals.

Note that the pending consumer addition proposals are stored under keys with the following format: PendingCAPBytePrefix | spawnTime.UnixNano() | chainID Thus, the returned array is in spawnTime order. If two proposals have the same spawnTime, then they are ordered by chainID.

func (Keeper) GetAllPendingConsumerRemovalProps

func (k Keeper) GetAllPendingConsumerRemovalProps(ctx sdk.Context) (props []types.ConsumerRemovalProposal)

GetAllPendingConsumerRemovalProps iterates through the pending consumer removal proposals.

Note that the pending consumer removal proposals are stored under keys with the following format: PendingCRPBytePrefix | stopTime.UnixNano() | chainID Thus, the returned array is in stopTime order.

func (Keeper) GetAllThrottledPacketData

func (k Keeper) GetAllThrottledPacketData(ctx sdktypes.Context, consumerChainID string) (
	slashData []ccvtypes.SlashPacketData, vscMaturedData []ccvtypes.VSCMaturedPacketData,
	rawOrderedData []interface{}, ibcSeqNums []uint64,
)

GetAllThrottledPacketData returns all throttled packet data for a specific consumer chain.

Note: This method is only used by tests and queries, hence why it returns redundant data as different types. Since this method executes on query, no panics are explicitly included.

func (Keeper) GetAllUnbondingOpIndexes

func (k Keeper) GetAllUnbondingOpIndexes(ctx sdk.Context, chainID string) (indexes []types.VscUnbondingOps)

GetAllUnbondingOpIndexes gets all unbonding indexes for a given chain id, i.e., all the IDs of unbonding operations that are waiting for VSCMaturedPackets from a consumer with chainID.

Note that the unbonding indexes for a given chainID are stored under keys with the following format: UnbondingOpIndexBytePrefix | len(chainID) | chainID | vscID Thus, the returned array is in ascending order of vscIDs.

func (Keeper) GetAllUnbondingOps

func (k Keeper) GetAllUnbondingOps(ctx sdk.Context) (ops []types.UnbondingOp)

GetAllUnbondingOps gets all UnbondingOps, where each UnbondingOp consists of its unique ID and a list of consumer chainIDs that the unbonding operation is waiting on.

Note that UnbondingOps are stored under keys with the following format: UnbondingOpBytePrefix | ID Thus, the iteration is in ascending order of IDs.

func (Keeper) GetAllValidatorConsumerPubKeys

func (k Keeper) GetAllValidatorConsumerPubKeys(ctx sdk.Context, chainID *string) (validatorConsumerPubKeys []types.ValidatorConsumerPubKey)

GetAllValidatorConsumerPubKeys gets all the validators public keys assigned for a consumer chain If chainID is nil, it returns all the validators public keys assigned for all consumer chains

Note that the validators public keys assigned for a consumer chain are stored under keys with the following format: UnbondingOpIndexBytePrefix | len(chainID) | chainID | providerAddress Thus, the returned array is

  • in ascending order of providerAddresses, if chainID is not nil;
  • in undetermined order, if chainID is nil.

func (Keeper) GetAllValidatorsByConsumerAddr

func (k Keeper) GetAllValidatorsByConsumerAddr(ctx sdk.Context, chainID *string) (validatorConsumerAddrs []types.ValidatorByConsumerAddr)

GetValidatorsByConsumerAddrs gets all the mappings from consensus addresses on a given consumer chain to consensus addresses on the provider chain. If chainID is nil, it returns all the mappings from consensus addresses on all consumer chains.

Note that the mappings for a consumer chain are stored under keys with the following format: ValidatorsByConsumerAddrBytePrefix | len(chainID) | chainID | consumerAddress Thus, the returned array is

  • in ascending order of consumerAddresses, if chainID is not nil;
  • in undetermined order, if chainID is nil.

func (Keeper) GetAllValsetUpdateBlockHeights

func (k Keeper) GetAllValsetUpdateBlockHeights(ctx sdk.Context) (valsetUpdateBlockHeights []types.ValsetUpdateIdToHeight)

GetAllValsetUpdateBlockHeights gets all the block heights for all valset updates

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

func (Keeper) GetAllVscSendTimestamps

func (k Keeper) GetAllVscSendTimestamps(ctx sdk.Context, chainID string) (vscSendTimestamps []types.VscSendTimestamp)

GetAllVscSendTimestamps gets an array of all the vsc send timestamps of the given chainID.

Note that the vsc send timestamps of a given chainID are stored under keys with the following format: VscSendTimestampBytePrefix | len(chainID) | chainID | vscID Thus, the iteration is in ascending order of vscIDs, and as a result in send timestamp order.

func (Keeper) GetCCVTimeoutPeriod

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

GetCCVTimeoutPeriod returns the timeout period for sent ibc packets

func (Keeper) GetChainToChannel

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

GetChainToChannel gets the CCV channelID for the given consumer chainID

func (Keeper) GetChannelToChain

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

GetChannelToChain gets the consumer chainID for a given CCV channelID

func (Keeper) GetConsumerAdditionPropsToExecute

func (k Keeper) GetConsumerAdditionPropsToExecute(ctx sdk.Context) (propsToExecute []types.ConsumerAdditionProposal)

GetConsumerAdditionPropsToExecute returns the pending consumer addition proposals that are ready to be executed, i.e., consumer clients to be created. A prop is included in the returned list if its proposed spawn time has passed.

Note: this method is split out from BeginBlockInit to be easily unit tested.

func (Keeper) GetConsumerAddrsToPrune

func (k Keeper) GetConsumerAddrsToPrune(
	ctx sdk.Context,
	chainID string,
	vscID uint64,
) (consumerAddrsToPrune types.AddressList)

GetConsumerAddrsToPrune returns the list of consumer addresses that can be pruned once the VSCMaturedPacket with vscID is received

func (Keeper) GetConsumerClientId

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

GetConsumerClientId returns the client ID for the given chain ID.

func (Keeper) GetConsumerGenesis

func (k Keeper) GetConsumerGenesis(ctx sdk.Context, chainID string) (consumertypes.GenesisState, bool)

func (Keeper) GetConsumerRemovalPropsToExecute

func (k Keeper) GetConsumerRemovalPropsToExecute(ctx sdk.Context) []types.ConsumerRemovalProposal

GetConsumerRemovalPropsToExecute iterates over the pending consumer removal proposals and returns an ordered list of consumer removal proposals to be executed, ie. consumer chains to be stopped and removed from the provider chain. A prop is included in the returned list if its proposed stop time has passed.

Note: this method is split out from BeginBlockCCR to be easily unit tested.

func (Keeper) GetConsumerRewardDenomRegistrationFee

func (k Keeper) GetConsumerRewardDenomRegistrationFee(ctx sdk.Context) sdk.Coin

func (Keeper) GetConsumerRewardsPoolAddressStr

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

func (Keeper) GetEffectiveValPower

func (k Keeper) GetEffectiveValPower(ctx sdktypes.Context,
	valConsAddr providertypes.ProviderConsAddress,
) sdktypes.Int

Obtains the effective validator power relevant to a validator consensus address.

func (Keeper) GetFirstVscSendTimestamp

func (k Keeper) GetFirstVscSendTimestamp(ctx sdk.Context, chainID string) (vscSendTimestamp types.VscSendTimestamp, found bool)

GetFirstVscSendTimestamp gets the vsc send timestamp with the lowest vscID for the given chainID.

func (Keeper) GetInitChainHeight

func (k Keeper) GetInitChainHeight(ctx sdk.Context, chainID string) (uint64, bool)

GetInitChainHeight returns the provider block height when the given consumer chain was initiated

func (Keeper) GetInitTimeoutPeriod

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

GetInitTimeoutPeriod returns the init timeout period

func (Keeper) GetInitTimeoutTimestamp

func (k Keeper) GetInitTimeoutTimestamp(ctx sdk.Context, chainID string) (uint64, bool)

GetInitTimeoutTimestamp returns the init timeout timestamp for the given chain ID. This method is used only in testing.

func (Keeper) GetKeyAssignmentReplacement

func (k Keeper) GetKeyAssignmentReplacement(
	ctx sdk.Context,
	chainID string,
	providerAddr types.ProviderConsAddress,
) (prevCKey tmprotocrypto.PublicKey, power int64, found bool)

GetKeyAssignmentReplacement returns the previous assigned consumer key and the current power for a provider validator for which a key assignment was received in this block. Both are needed to update the validator's power on the consumer chain at the end of the current block.

func (Keeper) GetLeadingVSCMaturedData

func (k Keeper) GetLeadingVSCMaturedData(ctx sdktypes.Context, consumerChainID string) (
	vscMaturedData []ccvtypes.VSCMaturedPacketData, ibcSeqNums []uint64,
)

GetLeadingVSCMaturedData returns the leading vsc matured packet data instances for a chain-specific throttled packet data queue. Ie the vsc matured packet data instances that do not have any slash packet data instances preceding them in the queue for consumerChainID.

func (Keeper) GetMaturedUnbondingOps

func (k Keeper) GetMaturedUnbondingOps(ctx sdk.Context) (ids []uint64)

GetMaturedUnbondingOps returns the list of matured unbonding operation ids

func (Keeper) GetMaxThrottledPackets

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

GetMaxThrottledPackets returns the maximum amount of throttled slash or vsc matured packets that can be queued for a single consumer before the provider chain halts.

func (Keeper) GetParams

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

GetParams returns the paramset for the provider module

func (Keeper) GetPendingConsumerAdditionProp

func (k Keeper) GetPendingConsumerAdditionProp(ctx sdk.Context, spawnTime time.Time,
	chainID string,
) (prop types.ConsumerAdditionProposal, found bool)

GetPendingConsumerAdditionProp retrieves a pending consumer addition proposal by spawn time and chain id.

Note: this method is only used in testing

func (Keeper) GetPendingVSCPackets

func (k Keeper) GetPendingVSCPackets(ctx sdk.Context, chainID string) []ccv.ValidatorSetChangePacketData

GetPendingVSCPackets returns the list of pending ValidatorSetChange packets stored under chain ID

func (Keeper) GetPort

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

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

func (Keeper) GetProviderAddrFromConsumerAddr

func (k Keeper) GetProviderAddrFromConsumerAddr(
	ctx sdk.Context,
	chainID string,
	consumerAddr types.ConsumerConsAddress,
) types.ProviderConsAddress

GetProviderAddrFromConsumerAddr returns the consensus address of a validator with consAddr set as the consensus address on a consumer chain

func (Keeper) GetSlashAcks

func (k Keeper) GetSlashAcks(ctx sdk.Context, chainID string) []string

GetSlashAcks returns the slash acks stored under the given chain ID

TODO: SlashAcks should be persisted as a list of ConsumerConsAddr types, not strings. See https://github.com/cosmos/interchain-security/issues/728

func (Keeper) GetSlashAndTrailingData

func (k Keeper) GetSlashAndTrailingData(ctx sdktypes.Context, consumerChainID string) (
	slashFound bool, slashData ccvtypes.SlashPacketData, vscMaturedData []ccvtypes.VSCMaturedPacketData,

	ibcSeqNums []uint64,
)

GetSlashAndTrailingData returns the first slash packet data instance and any trailing vsc matured packet data instances in the chain-specific throttled packet data queue.

Note that throttled packet data is stored under keys with the following format: ThrottledPacketDataBytePrefix | len(chainID) | chainID | ibcSeqNum Thus, the returned array is in ascending order of ibc seq numbers.

func (Keeper) GetSlashLog

func (k Keeper) GetSlashLog(
	ctx sdk.Context,
	providerAddr types.ProviderConsAddress,
) (found bool)

GetSlashLog returns a validator's slash log status True will be returned if an entry exists for a given validator address

func (Keeper) GetSlashLogOnlyForTesting

func (k Keeper) GetSlashLogOnlyForTesting(
	ctx sdk.Context,
	providerAddr sdk.ConsAddress,
) (found bool)

LEGACY METHOD USED FOR TESTING MIGRATION ONLY. DO NOT USE! This method mimics GetSlashLog from ICS v1.0.0.

func (Keeper) GetSlashMeter

func (k Keeper) GetSlashMeter(ctx sdktypes.Context) sdktypes.Int

GetSlashMeter returns a meter (persisted as a signed int) which stores an amount of voting power, corresponding to an allowance of validators that can be jailed/tombstoned over time.

Note: the value of this int should always be in the range of tendermint's [-MaxVotingPower, MaxVotingPower]

func (Keeper) GetSlashMeterAllowance

func (k Keeper) GetSlashMeterAllowance(ctx sdktypes.Context) sdktypes.Int

GetSlashMeterAllowance returns the amount of voting power units (int) that would be added to the slash meter for a replenishment that would happen this block, this allowance value also serves as the max value for the meter for this block.

Note: allowance can change between blocks, since it is directly correlated to total voting power. The slash meter must be less than or equal to the allowance for this block, before any slash packet handling logic can be executed.

func (Keeper) GetSlashMeterReplenishFraction

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

GetSlashMeterReplenishFraction returns the string fraction of total voting power that is replenished to the slash meter every replenish period. This param also serves as a maximum fraction of total voting power that the slash meter can hold.

func (Keeper) GetSlashMeterReplenishPeriod

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

GetSlashMeterReplenishPeriod returns the period in which: Once the slash meter becomes not-full, the slash meter is replenished after this period.

func (Keeper) GetSlashMeterReplenishTimeCandidate

func (k Keeper) GetSlashMeterReplenishTimeCandidate(ctx sdktypes.Context) time.Time

GetSlashMeterReplenishTimeCandidate returns the next UTC time the slash meter could potentially be replenished.

Note: this value is the next time the slash meter will be replenished IFF the slash meter is NOT full. Otherwise this value will be updated in every future block until the slash meter becomes NOT full.

func (Keeper) GetTemplateClient

func (k Keeper) GetTemplateClient(ctx sdk.Context) *ibctmtypes.ClientState

GetTemplateClient returns the template client for provider proposals

func (Keeper) GetThrottledPacketDataSize

func (k Keeper) GetThrottledPacketDataSize(ctx sdktypes.Context, consumerChainID string) uint64

GetThrottledPacketDataSize returns the size of the throttled packet data queue for the given consumer chain

func (Keeper) GetTrustingPeriodFraction

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

GetTrustingPeriodFraction returns a TrustingPeriodFraction used to compute the provider IBC client's TrustingPeriod as UnbondingPeriod / TrustingPeriodFraction

func (Keeper) GetUnbondingOp

func (k Keeper) GetUnbondingOp(ctx sdk.Context, id uint64) (types.UnbondingOp, bool)

GetUnbondingOp gets a UnbondingOp by its unique ID

func (Keeper) GetUnbondingOpIndex

func (k Keeper) GetUnbondingOpIndex(ctx sdk.Context, chainID string, vscID uint64) ([]uint64, bool)

GetUnbondingOpIndex gets the IDs of unbonding operations that are waiting for a VSCMaturedPacket with vscID from a consumer with chainID

func (Keeper) GetUnbondingOpsFromIndex

func (k Keeper) GetUnbondingOpsFromIndex(ctx sdk.Context, chainID string, valsetUpdateID uint64) (entries []types.UnbondingOp)

GetUnbondingOpsFromIndex gets the unbonding ops waiting for a given chainID and vscID

func (Keeper) GetValidatorByConsumerAddr

func (k Keeper) GetValidatorByConsumerAddr(
	ctx sdk.Context,
	chainID string,
	consumerAddr types.ConsumerConsAddress,
) (providerAddr types.ProviderConsAddress, found bool)

GetValidatorByConsumerAddr returns a validator's consensus address on the provider given the validator's consensus address on a consumer

func (Keeper) GetValidatorConsumerPubKey

func (k Keeper) GetValidatorConsumerPubKey(
	ctx sdk.Context,
	chainID string,
	providerAddr types.ProviderConsAddress,
) (consumerKey tmprotocrypto.PublicKey, found bool)

GetValidatorConsumerPubKey returns a validator's public key assigned for a consumer chain

func (Keeper) GetValidatorSetUpdateId

func (k Keeper) GetValidatorSetUpdateId(ctx sdk.Context) (validatorSetUpdateId uint64)

func (Keeper) GetValsetUpdateBlockHeight

func (k Keeper) GetValsetUpdateBlockHeight(ctx sdk.Context, valsetUpdateId uint64) (uint64, bool)

GetValsetUpdateBlockHeight gets the block height for a given valset update id

func (Keeper) GetVscSendTimestamp

func (k Keeper) GetVscSendTimestamp(ctx sdk.Context, chainID string, vscID uint64) (time.Time, bool)

GetVscSendTimestamp returns a VSC send timestamp by chainID and vscID

Note: This method is used only for testing.

func (Keeper) GetVscTimeoutPeriod

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

GetVscTimeoutPeriod returns the vsc timeout period

func (Keeper) HandleConsumerAdditionProposal

func (k Keeper) HandleConsumerAdditionProposal(ctx sdk.Context, p *types.ConsumerAdditionProposal) error

HandleConsumerAdditionProposal will receive the consumer chain's client state from the proposal. If the client can be successfully created in a cached context, it stores the proposal as a pending proposal.

Note: This method implements SpawnConsumerChainProposalHandler in spec. See: https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/methods.md#ccv-pcf-hcaprop1 Spec tag: [CCV-PCF-HCAPROP.1]

func (Keeper) HandleConsumerRemovalProposal

func (k Keeper) HandleConsumerRemovalProposal(ctx sdk.Context, p *types.ConsumerRemovalProposal) error

HandleConsumerRemovalProposal stops a consumer chain and released the outstanding unbonding operations. If the consumer can be successfully stopped in a cached context, it stores the proposal as a pending proposal.

This method implements StopConsumerChainProposalHandler from spec. See: https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/methods.md#ccv-pcf-hcrprop1 Spec tag: [CCV-PCF-HCRPROP.1]

func (Keeper) HandleEquivocationProposal

func (k Keeper) HandleEquivocationProposal(ctx sdk.Context, p *types.EquivocationProposal) error

HandleEquivocationProposal handles an equivocation proposal. Proposal will be accepted if a record in the SlashLog exists for a given validator address.

func (Keeper) HandleLeadingVSCMaturedPackets

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

HandleLeadingVSCMaturedPackets handles all VSCMatured packet data that has been queued this block, but does not need to be throttled. The handled data is then removed from the queue.

Note: VSC matured packet data which is queued behind slash packet data CANNOT be handled until the leading slash packet data has been handled. This is to maintain the "VSC Maturity and Slashing Order" CCV property. If VSC matured packet data DOES NOT trail slash packet data for that consumer, it will be handled in this method, bypassing HandleThrottleQueues.

func (Keeper) HandlePacketDataForChain

func (k Keeper) HandlePacketDataForChain(ctx sdktypes.Context, consumerChainID string,
	slashPacketHandler func(sdktypes.Context, string, ccvtypes.SlashPacketData),
	vscMaturedPacketHandler func(sdktypes.Context, string, ccvtypes.VSCMaturedPacketData),
)

HandlePacketDataForChain handles only the first queued slash packet relevant to the passed consumer chainID, and then handles any trailing vsc matured packets in that (consumer chain specific) throttled packet data queue. The handled data is then deleted from the queue.

Note: Any packet data which is handled in this method is also deleted from the (consumer chain specific) queue.

func (Keeper) HandleSlashPacket

func (k Keeper) HandleSlashPacket(ctx sdk.Context, chainID string, data ccv.SlashPacketData)

HandleSlashPacket potentially jails a misbehaving validator for a downtime infraction. This method should NEVER be called with a double-sign infraction.

func (Keeper) HandleThrottleQueues

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

HandleThrottleQueues iterates over the global slash entry queue, and handles all or some portion of throttled (slash and/or VSC matured) packet data received from consumer chains. The slash meter is decremented appropriately in this method.

func (Keeper) HandleVSCMaturedPacket

func (k Keeper) HandleVSCMaturedPacket(ctx sdk.Context, chainID string, data ccv.VSCMaturedPacketData)

HandleVSCMaturedPacket handles a VSCMatured packet.

Note: This method should only panic for a system critical error like a failed marshal/unmarshal, or persistence of critical data.

func (*Keeper) Hooks

func (k *Keeper) Hooks() Hooks

Returns new provider hooks

func (Keeper) IncrementThrottledPacketDataSize

func (k Keeper) IncrementThrottledPacketDataSize(ctx sdktypes.Context, consumerChainID string)

IncrementThrottledPacketDataSize increments the size of the throttled packet data queue for the given consumer chain.

func (Keeper) IncrementValidatorSetUpdateId

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

func (Keeper) InitGenesis

func (k Keeper) InitGenesis(ctx sdk.Context, genState *types.GenesisState)

InitGenesis initializes the CCV provider state and binds to PortID.

func (Keeper) InitializeSlashMeter

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

InitializeSlashMeter initializes the slash meter to it's max value (also its allowance), and sets the replenish time candidate to one replenish period from current block time.

func (Keeper) IsBound

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

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

func (Keeper) Logger

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

Logger returns a module-specific logger.

func (Keeper) MakeConsumerGenesis

func (k Keeper) MakeConsumerGenesis(
	ctx sdk.Context,
	prop *types.ConsumerAdditionProposal,
) (gen consumertypes.GenesisState, nextValidatorsHash []byte, err error)

MakeConsumerGenesis constructs the consumer CCV module part of the genesis state.

func (Keeper) MustApplyKeyAssignmentToValUpdates

func (k Keeper) MustApplyKeyAssignmentToValUpdates(
	ctx sdk.Context,
	chainID string,
	valUpdates []abci.ValidatorUpdate,
) (newUpdates []abci.ValidatorUpdate)

MustApplyKeyAssignmentToValUpdates applies the key assignment to the validator updates received from the staking module. The method panics if the key-assignment state is corrupted.

func (Keeper) OnAcknowledgementPacket

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

OnAcknowledgementPacket handles acknowledgments for sent VSC packets

func (Keeper) OnRecvSlashPacket

func (k Keeper) OnRecvSlashPacket(ctx sdk.Context, packet channeltypes.Packet, data ccv.SlashPacketData) exported.Acknowledgement

OnRecvSlashPacket delivers a received slash packet, validates it and then queues the slash packet as pending if valid.

func (Keeper) OnRecvVSCMaturedPacket

func (k Keeper) OnRecvVSCMaturedPacket(
	ctx sdk.Context,
	packet channeltypes.Packet,
	data ccv.VSCMaturedPacketData,
) exported.Acknowledgement

OnRecvVSCMaturedPacket handles a VSCMatured packet

func (Keeper) OnTimeoutPacket

func (k Keeper) OnTimeoutPacket(ctx sdk.Context, packet channeltypes.Packet) error

OnTimeoutPacket aborts the transaction if no chain exists for the destination channel, otherwise it stops the chain

func (Keeper) PendingConsumerRemovalPropExists

func (k Keeper) PendingConsumerRemovalPropExists(ctx sdk.Context, chainID string, timestamp time.Time) bool

PendingConsumerRemovalPropExists checks whether a pending consumer removal proposal exists for the given consumer chain ID and stopTime

Note: this method is only used in testing

func (Keeper) PruneKeyAssignments

func (k Keeper) PruneKeyAssignments(ctx sdk.Context, chainID string, vscID uint64)

PruneKeyAssignments prunes the consumer addresses no longer needed as they cannot be referenced in slash requests (by a correct consumer)

func (Keeper) QueueGlobalSlashEntry

func (k Keeper) QueueGlobalSlashEntry(ctx sdktypes.Context, entry providertypes.GlobalSlashEntry)

QueueGlobalSlashEntry queues an entry to the "global" slash packet queue, used for throttling val power changes related to jailing/tombstoning over time. This "global" queue is used to coordinate the order of slash packet handling between chains, whereas the chain-specific queue is used to coordinate the order of slash and vsc matured packets relevant to each chain.

func (Keeper) QueueThrottledPacketData

func (k Keeper) QueueThrottledPacketData(
	ctx sdktypes.Context, consumerChainID string, ibcSeqNum uint64, packetData interface{},
) error

QueueThrottledPacketData queues a slash packet data or vsc matured packet data instance for the given consumer chain's queue.

Note: This method returns an error because it is called from OnRecvSlashPacket and OnRecvVSCMaturedPacket, meaning we can return an ibc err ack to the counter party chain on error, instead of panicking this chain.

func (Keeper) QueueThrottledSlashPacketData

func (k Keeper) QueueThrottledSlashPacketData(
	ctx sdktypes.Context, consumerChainID string, ibcSeqNum uint64, data ccvtypes.SlashPacketData,
) error

QueueThrottledSlashPacketData queues the slash packet data for a chain-specific throttled packet data queue.

Note: This queue is shared between pending slash packet data and pending vsc matured packet data.

func (Keeper) QueueThrottledVSCMaturedPacketData

func (k Keeper) QueueThrottledVSCMaturedPacketData(
	ctx sdktypes.Context, consumerChainID string, ibcSeqNum uint64, data ccvtypes.VSCMaturedPacketData,
) error

QueueThrottledVSCMaturedPacketData queues the vsc matured packet data for a chain-specific throttled packet data queue.

Note: This queue is shared between pending slash packet data and pending vsc matured packet data.

func (Keeper) QueueVSCPackets

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

QueueVSCPackets queues latest validator updates for every registered consumer chain

func (Keeper) RegisterConsumerRewardDenom

func (k Keeper) RegisterConsumerRewardDenom(ctx sdk.Context, denom string, sender sdk.AccAddress) error

func (Keeper) RemoveConsumerFromUnbondingOp

func (k Keeper) RemoveConsumerFromUnbondingOp(ctx sdk.Context, id uint64, chainID string) (canComplete bool)

RemoveConsumerFromUnbondingOp removes a consumer chain ID that the unbonding op with 'id' is waiting on. The method returns true if the unbonding op can complete. In this case the record is removed from store. The method panics if the unbonding op with 'id' is not found.

func (Keeper) ReplenishSlashMeter

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

func (Keeper) SendVSCPackets

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

SendVSCPackets iterates over all registered consumers and sends pending VSC packets to the chains with established CCV channels. If the CCV channel is not established for a consumer chain, the updates will remain queued until the channel is established

func (Keeper) SendVSCPacketsToChain

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

SendVSCPacketsToChain sends all queued VSC packets to the specified chain

func (Keeper) SetChainToChannel

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

SetChainToChannel sets the mapping from a consumer chainID to the CCV channel ID for that consumer chain.

func (Keeper) SetChannelToChain

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

SetChannelToChain sets the mapping from the CCV channel ID to the consumer chainID.

func (Keeper) SetConsumerChain

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

SetConsumerChain ensures that the consumer chain has not already been set by a different channel, and then sets the consumer chain mappings in keeper, and set the channel status to validating. If there is already a CCV channel between the provider and consumer chain then close the channel, so that another channel can be made.

SetConsumerChain is called by OnChanOpenConfirm.

func (Keeper) SetConsumerClientId

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

SetConsumerClientId sets the client ID for the given chain ID

func (Keeper) SetConsumerGenesis

func (k Keeper) SetConsumerGenesis(ctx sdk.Context, chainID string, gen consumertypes.GenesisState) error

func (Keeper) SetConsumerRewardDenom

func (k Keeper) SetConsumerRewardDenom(
	ctx sdk.Context,
	denom string,
)

func (Keeper) SetInitChainHeight

func (k Keeper) SetInitChainHeight(ctx sdk.Context, chainID string, height uint64)

SetInitChainHeight sets the provider block height when the given consumer chain was initiated

func (Keeper) SetInitTimeoutTimestamp

func (k Keeper) SetInitTimeoutTimestamp(ctx sdk.Context, chainID string, ts uint64)

SetInitTimeoutTimestamp sets the init timeout timestamp for the given chain ID

func (Keeper) SetKeyAssignmentReplacement

func (k Keeper) SetKeyAssignmentReplacement(
	ctx sdk.Context,
	chainID string,
	providerAddr types.ProviderConsAddress,
	prevCKey tmprotocrypto.PublicKey,
	power int64,
)

SetKeyAssignmentReplacement sets the previous assigned consumer key and the current power for a provider validator for which a key assignment was received in this block. Both are needed to update the validator's power on the consumer chain at the end of the current block.

func (*Keeper) SetParamSpace

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

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

func (Keeper) SetParams

func (k Keeper) SetParams(ctx sdk.Context, params types.Params)

SetParams sets the params for the provider module

func (Keeper) SetPendingConsumerAdditionProp

func (k Keeper) SetPendingConsumerAdditionProp(ctx sdk.Context, prop *types.ConsumerAdditionProposal)

SetPendingConsumerAdditionProp stores a pending consumer addition proposal.

Note that the pending consumer addition proposals are stored under keys with the following format: PendingCAPBytePrefix | spawnTime | chainID Thus, if multiple consumer addition proposal for the same chain will pass at the same time, then only the last one will be stored.

func (Keeper) SetPendingConsumerRemovalProp

func (k Keeper) SetPendingConsumerRemovalProp(ctx sdk.Context, prop *types.ConsumerRemovalProposal)

SetPendingConsumerRemovalProp stores a pending consumer removal proposal.

Note that the pending removal addition proposals are stored under keys with the following format: PendingCRPBytePrefix | stopTime | chainID Thus, if multiple removal addition proposal for the same chain will pass at the same time, then only the last one will be stored.

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) SetSlashAcks

func (k Keeper) SetSlashAcks(ctx sdk.Context, chainID string, acks []string)

SetSlashAcks sets the slash acks under the given chain ID

TODO: SlashAcks should be persisted as a list of ConsumerConsAddr types, not strings. See https://github.com/cosmos/interchain-security/issues/728

func (Keeper) SetSlashLog

func (k Keeper) SetSlashLog(
	ctx sdk.Context,
	providerAddr types.ProviderConsAddress,
)

SetSlashLog updates validator's slash log for a consumer chain If an entry exists for a given validator address, at least one double signing slash packet was received by the provider from at least one consumer chain

func (Keeper) SetSlashLogOnlyForTesting

func (k Keeper) SetSlashLogOnlyForTesting(
	ctx sdk.Context,
	providerAddr sdk.ConsAddress,
)

LEGACY METHOD USED FOR TESTING MIGRATION ONLY. DO NOT USE! This method mimics SetSlashLog from ICS v1.0.0.

func (Keeper) SetSlashMeter

func (k Keeper) SetSlashMeter(ctx sdktypes.Context, value sdktypes.Int)

SetSlashMeter sets the slash meter to the given signed int value

Note: the value of this int should always be in the range of tendermint's [-MaxTotalVotingPower, MaxTotalVotingPower]

func (Keeper) SetSlashMeterReplenishTimeCandidate

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

SetSlashMeterReplenishTimeCandidate sets the next time the slash meter may be replenished to the current block time + the configured slash meter replenish period.

Note: this value is the next time the slash meter will be replenished IFF the slash meter is NOT full. Otherwise this value will be updated in every future block until the slash meter becomes NOT full.

func (Keeper) SetThrottledPacketDataSize

func (k Keeper) SetThrottledPacketDataSize(ctx sdktypes.Context, consumerChainID string, size uint64)

SetThrottledPacketDataSize sets the size of the throttled packet data queue for the given consumer chain

func (Keeper) SetUnbondingOp

func (k Keeper) SetUnbondingOp(ctx sdk.Context, unbondingOp types.UnbondingOp)

SetUnbondingOp sets the UnbondingOp by its unique ID

func (Keeper) SetUnbondingOpIndex

func (k Keeper) SetUnbondingOpIndex(ctx sdk.Context, chainID string, vscID uint64, ids []uint64)

SetUnbondingOpIndex sets the IDs of unbonding operations that are waiting for a VSCMaturedPacket with vscID from a consumer with chainID

func (Keeper) SetValidatorByConsumerAddr

func (k Keeper) SetValidatorByConsumerAddr(
	ctx sdk.Context,
	chainID string,
	consumerAddr types.ConsumerConsAddress,
	providerAddr types.ProviderConsAddress,
)

SetValidatorByConsumerAddr sets the mapping from a validator's consensus address on a consumer to the validator's consensus address on the provider

func (Keeper) SetValidatorConsumerPubKey

func (k Keeper) SetValidatorConsumerPubKey(
	ctx sdk.Context,
	chainID string,
	providerAddr types.ProviderConsAddress,
	consumerKey tmprotocrypto.PublicKey,
)

SetValidatorConsumerPubKey sets a validator's public key assigned for a consumer chain

func (Keeper) SetValidatorSetUpdateId

func (k Keeper) SetValidatorSetUpdateId(ctx sdk.Context, valUpdateID uint64)

func (Keeper) SetValsetUpdateBlockHeight

func (k Keeper) SetValsetUpdateBlockHeight(ctx sdk.Context, valsetUpdateId, blockHeight uint64)

SetValsetUpdateBlockHeight sets the block height for a given valset update id

func (Keeper) SetVscSendTimestamp

func (k Keeper) SetVscSendTimestamp(
	ctx sdk.Context,
	chainID string,
	vscID uint64,
	timestamp time.Time,
)

SetVscSendTimestamp sets the VSC send timestamp for a VSCPacket with ID vscID sent to a chain with ID chainID

func (Keeper) SetVscTimeoutPeriod

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

SetVscTimeoutPeriod sets the vsc timeout period

func (Keeper) StopConsumerChain

func (k Keeper) StopConsumerChain(ctx sdk.Context, chainID string, closeChan bool) (err error)

StopConsumerChain cleans up the states for the given consumer chain ID and completes the outstanding unbonding operations on the consumer chain.

This method implements StopConsumerChain from spec. See: https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/methods.md#ccv-pcf-stcc1 Spec tag: [CCV-PCF-STCC.1]

func (Keeper) StopConsumerChainInCachedCtx

func (k Keeper) StopConsumerChainInCachedCtx(ctx sdk.Context, p types.ConsumerRemovalProposal) (cc sdk.Context, writeCache func(), err error)

StopConsumerChainInCachedCtx stop a consumer chain from a given consumer removal proposal in a cached context

func (Keeper) TransferRewardsToFeeCollector

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

TransferRewardsToFeeCollector transfers all consumer rewards to the fee collector address

func (Keeper) ValidateSlashPacket

func (k Keeper) ValidateSlashPacket(ctx sdk.Context, chainID string,
	packet channeltypes.Packet, data ccv.SlashPacketData,
) error

ValidateSlashPacket validates a recv slash packet before it is handled or persisted in store. An error is returned if the packet is invalid, and an error ack should be relayed to the sender.

func (Keeper) VerifyConsumerChain

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

VerifyConsumerChain verifies that the chain trying to connect on the channel handshake is the expected consumer chain.

type Migrator

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

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

func NewMigrator

func NewMigrator(ccvProviderKeeper Keeper, ccvProviderParamSpace paramtypes.Subspace,
) Migrator

NewMigrator returns a new Migrator.

func (Migrator) Migratev1Tov2

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

Migratev1Tov2 migrates a provider from v1.0.0 to v2.0.0, and/or consensus version 1 -> 2.

Jump to

Keyboard shortcuts

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