2019-11-08 06:40:56 -08:00
|
|
|
package types
|
|
|
|
|
2020-10-08 02:22:22 -07:00
|
|
|
import "fmt"
|
|
|
|
|
2019-11-08 06:40:56 -08:00
|
|
|
const (
|
|
|
|
// ModuleName is the name of this module
|
|
|
|
ModuleName = "upgrade"
|
|
|
|
|
|
|
|
// RouterKey is used to route governance proposals
|
|
|
|
RouterKey = ModuleName
|
|
|
|
|
|
|
|
// StoreKey is the prefix under which we store this module's data
|
|
|
|
StoreKey = ModuleName
|
|
|
|
|
|
|
|
// QuerierKey is used to handle abci_query requests
|
|
|
|
QuerierKey = ModuleName
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
// PlanByte specifies the Byte under which a pending upgrade plan is stored in the store
|
|
|
|
PlanByte = 0x0
|
|
|
|
// DoneByte is a prefix for to look up completed upgrade plan by name
|
|
|
|
DoneByte = 0x1
|
2020-09-30 23:21:57 -07:00
|
|
|
|
2021-03-19 15:01:29 -07:00
|
|
|
// VersionMapByte is a prefix to look up module names (key) and versions (value)
|
|
|
|
VersionMapByte = 0x2
|
|
|
|
|
2021-04-02 07:11:58 -07:00
|
|
|
// ProtocolVersionByte is a prefix to look up Protocol Version
|
|
|
|
ProtocolVersionByte = 0x3
|
|
|
|
|
2020-11-24 03:45:33 -08:00
|
|
|
// KeyUpgradedIBCState is the key under which upgraded ibc state is stored in the upgrade store
|
|
|
|
KeyUpgradedIBCState = "upgradedIBCState"
|
|
|
|
|
|
|
|
// KeyUpgradedClient is the sub-key under which upgraded client state will be stored
|
2020-09-30 23:21:57 -07:00
|
|
|
KeyUpgradedClient = "upgradedClient"
|
2020-11-24 03:45:33 -08:00
|
|
|
|
|
|
|
// KeyUpgradedConsState is the sub-key under which upgraded consensus state will be stored
|
|
|
|
KeyUpgradedConsState = "upgradedConsState"
|
2019-11-08 06:40:56 -08:00
|
|
|
)
|
|
|
|
|
|
|
|
// PlanKey is the key under which the current plan is saved
|
|
|
|
// We store PlanByte as a const to keep it immutable (unlike a []byte)
|
|
|
|
func PlanKey() []byte {
|
|
|
|
return []byte{PlanByte}
|
|
|
|
}
|
2020-09-30 23:21:57 -07:00
|
|
|
|
|
|
|
// UpgradedClientKey is the key under which the upgraded client state is saved
|
|
|
|
// Connecting IBC chains can verify against the upgraded client in this path before
|
|
|
|
// upgrading their clients
|
2020-10-08 02:22:22 -07:00
|
|
|
func UpgradedClientKey(height int64) []byte {
|
2020-11-24 03:45:33 -08:00
|
|
|
return []byte(fmt.Sprintf("%s/%d/%s", KeyUpgradedIBCState, height, KeyUpgradedClient))
|
|
|
|
}
|
|
|
|
|
|
|
|
// UpgradedConsStateKey is the key under which the upgraded consensus state is saved
|
|
|
|
// Connecting IBC chains can verify against the upgraded consensus state in this path before
|
|
|
|
// upgrading their clients.
|
|
|
|
func UpgradedConsStateKey(height int64) []byte {
|
|
|
|
return []byte(fmt.Sprintf("%s/%d/%s", KeyUpgradedIBCState, height, KeyUpgradedConsState))
|
2020-09-30 23:21:57 -07:00
|
|
|
}
|