diff --git a/x/ccv/consumer/types/keys.go b/x/ccv/consumer/types/keys.go index e11390d9ed..f5a1754a73 100644 --- a/x/ccv/consumer/types/keys.go +++ b/x/ccv/consumer/types/keys.go @@ -49,6 +49,24 @@ const ( // received over CCV channel but not yet flushed over ABCI PendingChangesByteKey + // HistoricalInfoKey is the byte prefix that will store the historical info for a given height + HistoricalInfoBytePrefix + + // PacketMaturityTimePrefix is the byte prefix that will store maturity time for each received VSC packet + PacketMaturityTimeBytePrefix + + // HeightValsetUpdateIDPrefix is the byte prefix that will store the mapping from block height to valset update ID + HeightValsetUpdateIDBytePrefix + + // OutstandingDowntimePrefix is the byte prefix that will store the validators outstanding downtime by consensus address + OutstandingDowntimeBytePrefix + + // NOTE: This prefix is depreciated, but left in place to avoid consumer state migrations + PendingDataPacketsBytePrefix + + // CrossChainValidatorPrefix is the byte prefix that will store cross-chain validators by consensus address + CrossChainValidatorBytePrefix + // PendingDataPacketsByteKey is the byte key for storing // a list of data packets that cannot be sent yet to the provider // chain either because the CCV channel is not established or @@ -74,21 +92,6 @@ const ( // PrevStandaloneChainByteKey is the byte storing the flag marking whether this chain was previously standalone PrevStandaloneChainByteKey - // HistoricalInfoKey is the byte prefix that will store the historical info for a given height - HistoricalInfoBytePrefix - - // PacketMaturityTimePrefix is the byte prefix that will store maturity time for each received VSC packet - PacketMaturityTimeBytePrefix - - // HeightValsetUpdateIDPrefix is the byte prefix that will store the mapping from block height to valset update ID - HeightValsetUpdateIDBytePrefix - - // OutstandingDowntimePrefix is the byte prefix that will store the validators outstanding downtime by consensus address - OutstandingDowntimeBytePrefix - - // CrossChainValidatorPrefix is the byte prefix that will store cross-chain validators by consensus address - CrossChainValidatorBytePrefix - // NOTE: DO NOT ADD NEW BYTE PREFIXES HERE WITHOUT ADDING THEM TO getAllKeyPrefixes() IN keys_test.go ) @@ -126,40 +129,6 @@ func PendingChangesKey() []byte { return []byte{PendingChangesByteKey} } -// PendingDataPacketsKey returns the key for storing a list of data packets -// that cannot be sent yet to the provider chain either because the CCV channel -// is not established or because the client is expired. -func PendingDataPacketsKey() []byte { - return []byte{PendingDataPacketsByteKey} -} - -func PreCCVKey() []byte { - return []byte{PreCCVByteKey} -} - -func InitialValSetKey() []byte { - return []byte{InitialValSetByteKey} -} - -func InitGenesisHeightKey() []byte { - return []byte{InitGenesisHeightByteKey} -} - -func SmallestNonOptOutPowerKey() []byte { - return []byte{SmallestNonOptOutPowerByteKey} -} - -// StandaloneTransferChannelIDKey returns the key to the transfer channelID that existed from a standalone chain -// changing over to a consumer -func StandaloneTransferChannelIDKey() []byte { - return []byte{StandaloneTransferChannelIDByteKey} -} - -// PrevStandaloneChainKey returns the key to the flag marking whether this chain was previously standalone -func PrevStandaloneChainKey() []byte { - return []byte{PrevStandaloneChainByteKey} -} - // HistoricalInfoKey returns the key to historical info to a given block height func HistoricalInfoKey(height int64) []byte { hBytes := make([]byte, 8) @@ -197,6 +166,40 @@ func CrossChainValidatorKey(addr []byte) []byte { return append([]byte{CrossChainValidatorBytePrefix}, addr...) } +// PendingDataPacketsKey returns the key for storing a list of data packets +// that cannot be sent yet to the provider chain either because the CCV channel +// is not established or because the client is expired. +func PendingDataPacketsKey() []byte { + return []byte{PendingDataPacketsByteKey} +} + +func PreCCVKey() []byte { + return []byte{PreCCVByteKey} +} + +func InitialValSetKey() []byte { + return []byte{InitialValSetByteKey} +} + +func InitGenesisHeightKey() []byte { + return []byte{InitGenesisHeightByteKey} +} + +func SmallestNonOptOutPowerKey() []byte { + return []byte{SmallestNonOptOutPowerByteKey} +} + +// StandaloneTransferChannelIDKey returns the key to the transfer channelID that existed from a standalone chain +// changing over to a consumer +func StandaloneTransferChannelIDKey() []byte { + return []byte{StandaloneTransferChannelIDByteKey} +} + +// PrevStandaloneChainKey returns the key to the flag marking whether this chain was previously standalone +func PrevStandaloneChainKey() []byte { + return []byte{PrevStandaloneChainByteKey} +} + // NOTE: DO NOT ADD FULLY DEFINED KEY FUNCTIONS WITHOUT ADDING THEM TO getAllFullyDefinedKeys() IN keys_test.go // diff --git a/x/ccv/consumer/types/keys_test.go b/x/ccv/consumer/types/keys_test.go index fc214380b9..c0ab13391a 100644 --- a/x/ccv/consumer/types/keys_test.go +++ b/x/ccv/consumer/types/keys_test.go @@ -27,6 +27,11 @@ func getAllKeyPrefixes() []byte { ProviderClientByteKey, ProviderChannelByteKey, PendingChangesByteKey, + HistoricalInfoBytePrefix, + PacketMaturityTimeBytePrefix, + HeightValsetUpdateIDBytePrefix, + OutstandingDowntimeBytePrefix, + CrossChainValidatorBytePrefix, PendingDataPacketsByteKey, PreCCVByteKey, InitialValSetByteKey, @@ -34,11 +39,6 @@ func getAllKeyPrefixes() []byte { SmallestNonOptOutPowerByteKey, StandaloneTransferChannelIDByteKey, PrevStandaloneChainByteKey, - HistoricalInfoBytePrefix, - PacketMaturityTimeBytePrefix, - HeightValsetUpdateIDBytePrefix, - OutstandingDowntimeBytePrefix, - CrossChainValidatorBytePrefix, } } @@ -61,6 +61,11 @@ func getAllFullyDefinedKeys() [][]byte { ProviderClientIDKey(), ProviderChannelKey(), PendingChangesKey(), + HistoricalInfoKey(0), + PacketMaturityTimeKey(0, time.Time{}), + HeightValsetUpdateIDKey(0), + OutstandingDowntimeKey([]byte{}), + CrossChainValidatorKey([]byte{}), PendingDataPacketsKey(), PreCCVKey(), InitialValSetKey(), @@ -68,10 +73,5 @@ func getAllFullyDefinedKeys() [][]byte { SmallestNonOptOutPowerKey(), StandaloneTransferChannelIDKey(), PrevStandaloneChainKey(), - HistoricalInfoKey(0), - PacketMaturityTimeKey(0, time.Time{}), - HeightValsetUpdateIDKey(0), - OutstandingDowntimeKey([]byte{}), - CrossChainValidatorKey([]byte{}), } }