keeper

package
v4.2.0-rc0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: Apache-2.0 Imports: 41 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DiffValidators added in v4.1.0

func DiffValidators(
	currentValidators []types.ConsumerValidator,
	nextValidators []types.ConsumerValidator,
) []abci.ValidatorUpdate

DiffValidators compares the current and the next epoch's consumer validators and returns the `ValidatorUpdate` diff needed by CometBFT to update the validator set on a chain.

func NewMsgServerImpl

func NewMsgServerImpl(keeper *Keeper) types.MsgServer

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

func NoMoreThanPercentOfTheSum added in v4.2.0

func NoMoreThanPercentOfTheSum(validators []types.ConsumerValidator, percent uint32) []types.ConsumerValidator

NoMoreThanPercentOfTheSum returns a set of validators with updated powers such that no validator has more than the provided `percent` of the sum of all validators' powers. Operates on a best-effort basis.

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

func (Hooks) AfterProposalDeposit

func (h Hooks) AfterProposalDeposit(ctx sdk.Context, proposalID uint64, depositorAddr sdk.AccAddress)

func (Hooks) AfterProposalFailedMinDeposit

func (h Hooks) AfterProposalFailedMinDeposit(ctx sdk.Context, proposalID uint64)

func (Hooks) AfterProposalSubmission

func (h Hooks) AfterProposalSubmission(ctx sdk.Context, proposalID uint64)

AfterProposalSubmission - call hook if registered After a consumerAddition proposal submission, a record is created that maps the proposal ID to the consumer chain ID.

func (Hooks) AfterProposalVote

func (h Hooks) AfterProposalVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAddress)

func (Hooks) AfterProposalVotingPeriodEnded

func (h Hooks) AfterProposalVotingPeriodEnded(ctx sdk.Context, proposalID uint64)

AfterProposalVotingPeriodEnded - call hook if registered After proposal voting ends, the consumer chainID in store is deleted. When a consumerAddition proposal passes, the consumer chainID is available in providerKeeper.GetAllPendingConsumerAdditionProps or providerKeeper.GetAllConsumerChains(ctx).

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

func (Hooks) AfterValidatorBonded

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

func (Hooks) AfterValidatorCreated

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

func (Hooks) AfterValidatorRemoved

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

func (Hooks) BeforeDelegationCreated

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

func (Hooks) BeforeDelegationRemoved

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

func (Hooks) BeforeDelegationSharesModified

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

func (Hooks) BeforeTokenizeShareRecordRemoved

func (h Hooks) BeforeTokenizeShareRecordRemoved(_ sdk.Context, _ uint64) error

func (Hooks) BeforeValidatorModified

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

func (Hooks) BeforeValidatorSlashed

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

func (Hooks) GetConsumerAdditionLegacyPropFromProp

func (h Hooks) GetConsumerAdditionLegacyPropFromProp(
	ctx sdk.Context,
	proposalID uint64,
) (providertypes.ConsumerAdditionProposal, bool)

GetConsumerAdditionLegacyPropFromProp extracts a consumer addition legacy proposal from the proposal with the given ID

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 storetypes.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,
	distributionKeeper ccv.DistributionKeeper, bankKeeper ccv.BankKeeper,
	govKeeper ccv.GovKeeper, feeCollectorName string,
) Keeper

NewKeeper creates a new provider Keeper instance

func (Keeper) AllocateTokens added in v4.2.0

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

AllocateTokens performs rewards distribution to the community pool and validators based on the Partial Set Security distribution specification.

func (Keeper) AllocateTokensToConsumerValidators added in v4.2.0

func (k Keeper) AllocateTokensToConsumerValidators(
	ctx sdk.Context,
	chainID string,
	tokens sdk.DecCoins,
) (allocated sdk.DecCoins)

AllocateTokensToConsumerValidators allocates tokens to the given consumer chain's validator set

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, if it is either registered or currently voted on in a ConsumerAddition governance proposal

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

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

BeginBlockCIS contains the BeginBlock logic needed for the Consumer Initiated Slashing sub-protocol.

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) BeginBlockRD added in v4.2.0

func (k Keeper) BeginBlockRD(ctx sdk.Context, req abci.RequestBeginBlock)

BeginBlockRD executes BeginBlock logic for the Reward Distribution sub-protocol.

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) CapValidatorSet added in v4.2.0

func (k Keeper) CapValidatorSet(ctx sdk.Context, chainID string, validators []types.ConsumerValidator) []types.ConsumerValidator

CapValidatorSet caps the provided `validators` if chain `chainID` is an Opt In chain with a validator-set cap. If cap is `k`, `CapValidatorSet` returns the first `k` validators from `validators` with the highest power.

func (Keeper) CapValidatorsPower added in v4.2.0

func (k Keeper) CapValidatorsPower(ctx sdk.Context, chainID string, validators []types.ConsumerValidator) []types.ConsumerValidator

CapValidatorsPower caps the power of the validators on chain `chainID` and returns an updated slice of validators with their new powers. Works on a best-basis effort because there are cases where we cannot guarantee that all validators on the consumer chain have less power than the set validators-power cap. For example, if we have 10 validators and the power cap is set to 5%, we need at least one validator to have more than 10% of the voting power on the consumer chain.

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

func (k Keeper) CheckMisbehaviour(ctx sdk.Context, misbehaviour ibctmtypes.Misbehaviour) error

CheckMisbehaviour checks that headers in the given misbehaviour forms a valid light client attack on a light client that tracks an ICS consumer chain

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) ComputeConsumerTotalVotingPower added in v4.2.0

func (k Keeper) ComputeConsumerTotalVotingPower(ctx sdk.Context, chainID string) (totalPower int64)

ComputeConsumerTotalVotingPower returns the validator set total voting power for the given consumer chain

func (Keeper) ComputeMinPowerToOptIn added in v4.2.0

func (k Keeper) ComputeMinPowerToOptIn(ctx sdk.Context, chainID string, bondedValidators []stakingtypes.Validator, topN uint32) (int64, error)

ComputeMinPowerToOptIn returns the minimum power needed for a validator (from the bonded validators) to belong to the `topN` validators. `chainID` is only used for logging purposes.

func (Keeper) ComputeNextValidators added in v4.2.0

func (k Keeper) ComputeNextValidators(ctx sdk.Context, chainID string, bondedValidators []stakingtypes.Validator) []types.ConsumerValidator

ComputeNextValidators computes the validators for the upcoming epoch based on the currently `bondedValidators`.

func (Keeper) ComputePowerToSlash

func (k Keeper) ComputePowerToSlash(ctx sdk.Context, validator stakingtypes.Validator, undelegations []stakingtypes.UnbondingDelegation,
	redelegations []stakingtypes.Redelegation, power int64, powerReduction math.Int,
) int64

ComputePowerToSlash computes the power to be slashed based on the tokens in non-matured `undelegations` and `redelegations`, as well as the current `power` of the validator. Note that this method does not perform any slashing.

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) CreateConsumerValidator added in v4.2.0

func (k Keeper) CreateConsumerValidator(ctx sdk.Context, chainID string, validator stakingtypes.Validator) (types.ConsumerValidator, error)

CreateConsumerValidator creates a consumer validator for `chainID` from the given staking `validator`

func (Keeper) DeleteAllOptedIn added in v4.2.0

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

DeleteAllOptedIn deletes all the opted-in validators for chain with `chainID`

func (Keeper) DeleteAllowlist added in v4.2.0

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

DeleteAllowlist deletes all allowlisted validators

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) DeleteConsumerCommissionRate added in v4.2.0

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

DeleteConsumerCommissionRate the per-consumer chain commission rate associated to the given validator address

func (Keeper) DeleteConsumerGenesis

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

func (Keeper) DeleteConsumerRewardDenom

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

func (Keeper) DeleteConsumerValSet added in v4.1.0

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

DeleteConsumerValSet deletes all the stored consumer validators for chain `chainID`

func (Keeper) DeleteConsumerValidator added in v4.1.0

func (k Keeper) DeleteConsumerValidator(
	ctx sdk.Context,
	chainID string,
	providerConsAddr types.ProviderConsAddress,
)

DeleteConsumerValidator removes consumer validator with `providerAddr` address

func (Keeper) DeleteDenylist added in v4.2.0

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

DeleteDenylist deletes all denylisted validators

func (Keeper) DeleteEquivocationEvidenceMinHeight

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

DeleteEquivocationEvidenceMinHeight deletes the the minimum height of a valid consumer equivocation evidence for a given consumer chain ID

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) 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) DeleteOptedIn added in v4.2.0

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

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

func (k Keeper) DeleteProposedConsumerChainInStore(ctx sdk.Context, proposalID uint64)

DeleteProposedConsumerChainInStore deletes the consumer chainID from store which is in gov consumerAddition proposal

func (Keeper) DeleteSlashAcks

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

DeleteSlashAcks deletes the slash acks for a given chain ID

func (Keeper) DeleteTopN added in v4.2.0

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

DeleteTopN removes the N value associated to chain with `chainID`

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) DeleteValidatorSetCap added in v4.2.0

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

DeleteValidatorSetCap removes the validator-set cap value associated to chain with `chainID`

func (Keeper) DeleteValidatorsPowerCap added in v4.2.0

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

DeleteValidatorsPowerCap removes the power-cap value associated to chain with `chainID`

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) 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) FilterOptedInAndAllowAndDenylistedPredicate added in v4.2.0

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

FilterOptedInAndAllowAndDenylistedPredicate filters the opted-in validators that are allowlisted and not denylisted

func (Keeper) FilterValidators added in v4.2.0

func (k Keeper) FilterValidators(
	ctx sdk.Context,
	chainID string,
	bondedValidators []stakingtypes.Validator,
	predicate func(providerAddr types.ProviderConsAddress) bool,
) []types.ConsumerValidator

FilterValidators filters the provided `bondedValidators` according to `predicate` and returns the filtered set.

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) GetAllCommissionRateValidators added in v4.2.0

func (k Keeper) GetAllCommissionRateValidators(
	ctx sdk.Context,
	chainID string,
) (addresses []types.ProviderConsAddress)

GetAllCommissionRateValidators returns all the validator address that set a commission rate for the given chain ID

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) 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) GetAllOptedIn added in v4.2.0

func (k Keeper) GetAllOptedIn(
	ctx sdk.Context,
	chainID string,
) (providerConsAddresses []types.ProviderConsAddress)

GetAllOptedIn returns all the opted-in validators on chain `chainID`

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

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

GetAllPendingConsumerChainIDs gets pending consumer chains have not reach spawn time

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

func (k Keeper) GetAllProposedConsumerChainIDs(ctx sdk.Context) []types.ProposedChain

GetAllProposedConsumerChainIDs returns the proposed chainID of all gov consumerAddition proposals that are still in the voting period.

func (Keeper) GetAllRegisteredAndProposedChainIDs

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

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) GetBlocksPerEpoch added in v4.1.0

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

GetBlocksPerEpoch returns the number of blocks that constitute an epoch

func (Keeper) GetByzantineValidators

func (k Keeper) GetByzantineValidators(ctx sdk.Context, misbehaviour ibctmtypes.Misbehaviour) (validators []*tmtypes.Validator, err error)

GetByzantineValidators returns the validators that signed both headers. If the misbehavior is an equivocation light client attack, then these validators are the Byzantine validators.

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) GetConsumerCommissionRate added in v4.2.0

func (k Keeper) GetConsumerCommissionRate(
	ctx sdk.Context,
	chainID string,
	providerAddr types.ProviderConsAddress,
) (sdk.Dec, bool)

GetConsumerCommissionRate returns the per-consumer commission rate set for the given validator address

func (Keeper) GetConsumerGenesis

func (k Keeper) GetConsumerGenesis(ctx sdk.Context, chainID string) (ccv.ConsumerGenesisState, 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) GetConsumerRewardsAllocation added in v4.2.0

func (k Keeper) GetConsumerRewardsAllocation(ctx sdk.Context, chainID string) (pool types.ConsumerRewardsAllocation)

GetConsumerRewardsAllocation returns the consumer rewards allocation for the given chain ID

func (Keeper) GetConsumerRewardsPool added in v4.2.0

func (k Keeper) GetConsumerRewardsPool(ctx sdk.Context) sdk.Coins

GetConsumerRewardsPool returns the balance of the consumer rewards pool module account

func (Keeper) GetConsumerRewardsPoolAddressStr

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

func (Keeper) GetConsumerValSet added in v4.1.0

func (k Keeper) GetConsumerValSet(
	ctx sdk.Context,
	chainID string,
) (validators []types.ConsumerValidator)

GetConsumerValSet returns all the consumer validators for chain `chainID`

func (Keeper) GetEffectiveValPower

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

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

func (Keeper) GetEquivocationEvidenceMinHeight

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

GetEquivocationEvidenceMinHeight returns the the minimum height of a valid consumer equivocation evidence for a given consumer chain ID

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

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

GetMaturedUnbondingOps returns the list of matured unbonding operation ids

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

func (k Keeper) GetProposedConsumerChain(ctx sdk.Context, proposalID uint64) (string, bool)

GetProposedConsumerChain returns the proposed chainID for the given consumerAddition proposal ID. This method is only used for testing.

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

func (k Keeper) GetSlashMeter(ctx sdktypes.Context) math.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) math.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) GetTopN added in v4.2.0

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

GetTopN returns (N, true) if chain `chainID` has a top N associated, and (0, false) otherwise.

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) GetValidatorSetCap added in v4.2.0

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

GetValidatorSetCap returns `(c, true)` if chain `chainID` has validator-set cap `c` associated with it, and (0, false) otherwise

func (Keeper) GetValidatorSetUpdateId

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

func (Keeper) GetValidatorsPowerCap added in v4.2.0

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

GetValidatorsPowerCap returns `(p, true)` if chain `chainID` has power cap `p` associated with it, and (0, false) otherwise

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

func (k Keeper) HandleConsumerDoubleVoting(
	ctx sdk.Context,
	evidence *tmtypes.DuplicateVoteEvidence,
	chainID string,
	pubkey cryptotypes.PubKey,
) error

HandleConsumerDoubleVoting verifies a double voting evidence for a given a consumer chain ID and a public key and, if successful, executes the slashing, jailing, and tombstoning of the malicious validator.

func (Keeper) HandleConsumerMisbehaviour

func (k Keeper) HandleConsumerMisbehaviour(ctx sdk.Context, misbehaviour ibctmtypes.Misbehaviour) error

HandleConsumerMisbehaviour checks if the given IBC misbehaviour corresponds to an equivocation light client attack, and in this case, slashes, jails, and tombstones

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

func (k Keeper) HandleConsumerRewardDenomProposal(ctx sdk.Context, p *types.ChangeRewardDenomsProposal) error

func (Keeper) HandleOptIn added in v4.2.0

func (k Keeper) HandleOptIn(ctx sdk.Context, chainID string, providerAddr types.ProviderConsAddress, consumerKey *string) error

HandleOptIn prepares validator `providerAddr` to opt in to `chainID` with an optional `consumerKey` consumer public key. Note that the validator only opts in at the end of an epoch.

func (Keeper) HandleOptOut added in v4.2.0

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

HandleOptOut prepares validator `providerAddr` to opt out from running `chainID`. Note that the validator only opts out at the end of an epoch.

func (Keeper) HandleSetConsumerCommissionRate added in v4.2.0

func (k Keeper) HandleSetConsumerCommissionRate(ctx sdk.Context, chainID string, providerAddr types.ProviderConsAddress, commissionRate sdk.Dec) error

HandleSetConsumerCommissionRate sets a per-consumer chain commission rate for the given provider address on the condition that the given consumer chain exists.

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) 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) HasToValidate added in v4.2.0

func (k Keeper) HasToValidate(
	ctx sdk.Context,
	provAddr types.ProviderConsAddress,
	chainID string,
) (bool, error)

func (*Keeper) Hooks

func (k *Keeper) Hooks() Hooks

Returns new provider hooks

func (Keeper) IdentifyConsumerChainIDFromIBCPacket added in v4.2.0

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

IdentifyConsumerChainIDFromIBCPacket checks if the packet destination matches a registered consumer chain. If so, it returns the consumer chain ID, otherwise an error.

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) IsAllowlistEmpty added in v4.2.0

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

IsAllowlistEmpty returns `true` if no validator is allowlisted on chain `chainID`

func (Keeper) IsAllowlisted added in v4.2.0

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

IsAllowlisted returns `true` if validator with `providerAddr` has been allowlisted on chain `chainID`

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

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

IsConsumerProposedOrRegistered checks if a consumer chain is either registered, meaning either already running or will run soon, or proposed its ConsumerAdditionProposal was submitted but the chain was not yet added to ICS yet.

func (Keeper) IsConsumerValidator added in v4.1.0

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

IsConsumerValidator returns `true` if the consumer validator with `providerAddr` exists for chain `chainID` and `false` otherwise

func (Keeper) IsDenylistEmpty added in v4.2.0

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

IsDenylistEmpty returns `true` if no validator is denylisted on chain `chainID`

func (Keeper) IsDenylisted added in v4.2.0

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

IsDenylisted returns `true` if validator with `providerAddr` has been denylisted on chain `chainID`

func (Keeper) IsOptIn added in v4.2.0

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

IsOptIn returns true if chain with `chainID` is an Opt-In chain (i.e., no validator is forced to validate chain `chainID`)

func (Keeper) IsOptedIn added in v4.2.0

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

func (Keeper) IsTopN added in v4.2.0

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

IsTopN returns true if chain with `chainID` is a Top-N chain (i.e., enforces at least one validator to validate chain `chainID`)

func (Keeper) JailAndTombstoneValidator

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

JailAndTombstoneValidator jails and tombstones the validator with the given provider consensus address

func (Keeper) LegacyDeleteThrottledPacketDataForConsumer deprecated

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

Deprecated: LegacyDeleteThrottledPacketDataForConsumer is deprecated for ICS >= v4.0.0. LegacyDeleteThrottledPacketDataForConsumer removes all throttled packet data that was queued on the provider for a given consumer chain.

func (Keeper) LegacyGetAllThrottledPacketData deprecated

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

Deprecated: LegacyGetAllThrottledPacketData is deprecated for ICS >= v4.0.0. LegacyGetAllThrottledPacketData returns all throttled packet data that was queued on the provider for a given consumer chain.

func (Keeper) LegacyQueueThrottledPacketData deprecated

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

Deprecated: LegacyQueueThrottledPacketData is deprecated for ICS >= v4.0.0. LegacyQueueThrottledPacketData queues throttled packet data for a given consumer chain on the provider. The method should not be used because the provider does not process throttled packet data anymore.

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 ccv.ConsumerGenesisState, nextValidatorsHash []byte, err error)

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

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,
) (ccv.PacketAckResult, error)

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,
) error

OnRecvVSCMaturedPacket handles a VSCMatured packet and returns a no-op result ack.

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) OptInTopNValidators added in v4.2.0

func (k Keeper) OptInTopNValidators(ctx sdk.Context, chainID string, bondedValidators []stakingtypes.Validator, minPowerToOptIn int64)

OptInTopNValidators opts in to `chainID` all the `bondedValidators` that have at least `minPowerToOptIn` power

func (Keeper) ParseConsumerKey added in v4.2.0

func (k Keeper) ParseConsumerKey(consumerKey string) (tmprotocrypto.PublicKey, error)

ParseConsumerKey parses the ED25519 PubKey`consumerKey` from a JSON string and constructs its corresponding `tmprotocrypto.PublicKey`

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) QueryConsumerChainOptedInValidators added in v4.2.0

QueryConsumerChainOptedInValidators returns all validators that opted-in to a given consumer chain

func (Keeper) QueryConsumerChainsValidatorHasToValidate added in v4.2.0

QueryConsumerChainsValidatorHasToValidate returns all consumer chains that the given validator has to validate now or in the next epoch if nothing changes.

func (Keeper) QueryOldestUnconfirmedVsc added in v4.1.0

func (Keeper) QueryParams added in v4.1.0

QueryParams returns all parameters and current values of provider

func (Keeper) QueryValidatorConsumerCommissionRate added in v4.2.0

QueryValidatorConsumerCommissionRate returns the commission rate a given validator charges on a given consumer chain

func (Keeper) QueueVSCPackets

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

QueueVSCPackets queues latest validator updates for every registered consumer chain

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) SetAllowlist added in v4.2.0

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

SetAllowlist allowlists validator with `providerAddr` address on chain `chainID`

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) SetConsumerCommissionRate added in v4.2.0

func (k Keeper) SetConsumerCommissionRate(
	ctx sdk.Context,
	chainID string,
	providerAddr types.ProviderConsAddress,
	commissionRate sdk.Dec,
) error

SetConsumerCommissionRate sets a per-consumer chain commission rate for the given validator address

func (Keeper) SetConsumerGenesis

func (k Keeper) SetConsumerGenesis(ctx sdk.Context, chainID string, gen ccv.ConsumerGenesisState) error

func (Keeper) SetConsumerRewardDenom

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

func (Keeper) SetConsumerRewardsAllocation added in v4.2.0

func (k Keeper) SetConsumerRewardsAllocation(ctx sdk.Context, chainID string, pool types.ConsumerRewardsAllocation)

SetConsumerRewardsAllocation sets the consumer rewards allocation for the given chain ID

func (Keeper) SetConsumerValSet added in v4.1.0

func (k Keeper) SetConsumerValSet(ctx sdk.Context, chainID string, nextValidators []types.ConsumerValidator)

SetConsumerValSet resets the current consumer validators with the `nextValidators` computed by `FilterValidators` and hence this method should only be called after `FilterValidators` has completed.

func (Keeper) SetConsumerValidator added in v4.1.0

func (k Keeper) SetConsumerValidator(
	ctx sdk.Context,
	chainID string,
	validator types.ConsumerValidator,
)

SetConsumerValidator sets provided consumer `validator` on the consumer chain with `chainID`

func (Keeper) SetDenylist added in v4.2.0

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

SetDenylist denylists validator with `providerAddr` address on chain `chainID`

func (Keeper) SetEquivocationEvidenceMinHeight

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

SetEquivocationEvidenceMinHeight sets the the minimum height of a valid consumer equivocation evidence for a given consumer chain ID

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) SetOptedIn added in v4.2.0

func (k Keeper) SetOptedIn(
	ctx sdk.Context,
	chainID string,
	providerConsAddress types.ProviderConsAddress,
)

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

func (k Keeper) SetProposedConsumerChain(ctx sdk.Context, chainID string, proposalID uint64)

SetProposedConsumerChain stores a consumer chainId corresponding to a submitted consumer addition proposal This consumer chainId is deleted once the voting period for the proposal ends.

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

func (k Keeper) SetSlashMeter(ctx sdktypes.Context, value math.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) SetTopN added in v4.2.0

func (k Keeper) SetTopN(
	ctx sdk.Context,
	chainID string,
	N uint32,
)

SetTopN stores the N value associated to chain with `chainID`

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) SetValidatorSetCap added in v4.2.0

func (k Keeper) SetValidatorSetCap(
	ctx sdk.Context,
	chainID string,
	c uint32,
)

SetValidatorSetCap stores the validator-set cap value `c` associated to chain with `chainID`

func (Keeper) SetValidatorSetUpdateId

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

func (Keeper) SetValidatorsPowerCap added in v4.2.0

func (k Keeper) SetValidatorsPowerCap(
	ctx sdk.Context,
	chainID string,
	p uint32,
)

SetValidatorsPowerCap sets the power-cap value `p` associated to chain with `chainID`

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

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

SlashValidator slashes validator with given provider Address

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) TransferConsumerRewardsToDistributionModule added in v4.2.0

func (k Keeper) TransferConsumerRewardsToDistributionModule(
	ctx sdk.Context,
	chainID string,
) (sdk.Coins, error)

TransferConsumerRewardsToDistributionModule transfers the rewards allocation of the given consumer chain from the consumer rewards pool to a the distribution module

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

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

ValidatorConsensusKeyInUse checks if the given consensus key is already used by validator in a consumer chain. Note that this method 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.

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.

func (Keeper) VerifyDoubleVotingEvidence

func (k Keeper) VerifyDoubleVotingEvidence(
	evidence tmtypes.DuplicateVoteEvidence,
	chainID string,
	pubkey cryptotypes.PubKey,
) error

VerifyDoubleVotingEvidence verifies a double voting evidence for a given chain id and a validator public key

Jump to

Keyboard shortcuts

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