github.com/Finschia/finschia-sdk@v0.48.1/x/upgrade/types/keys.go (about)

     1  package types
     2  
     3  import "fmt"
     4  
     5  const (
     6  	// ModuleName is the name of this module
     7  	ModuleName = "upgrade"
     8  
     9  	// RouterKey is used to route governance proposals
    10  	RouterKey = ModuleName
    11  
    12  	// StoreKey is the prefix under which we store this module's data
    13  	StoreKey = ModuleName
    14  
    15  	// QuerierKey is used to handle abci_query requests
    16  	QuerierKey = ModuleName
    17  )
    18  
    19  const (
    20  	// PlanByte specifies the Byte under which a pending upgrade plan is stored in the store
    21  	PlanByte = 0x0
    22  	// DoneByte is a prefix for to look up completed upgrade plan by name
    23  	DoneByte = 0x1
    24  
    25  	// VersionMapByte is a prefix to look up module names (key) and versions (value)
    26  	VersionMapByte = 0x2
    27  
    28  	// ProtocolVersionByte is a prefix to look up Protocol Version
    29  	ProtocolVersionByte = 0x3
    30  
    31  	// KeyUpgradedIBCState is the key under which upgraded ibc state is stored in the upgrade store
    32  	KeyUpgradedIBCState = "upgradedIBCState"
    33  
    34  	// KeyUpgradedClient is the sub-key under which upgraded client state will be stored
    35  	KeyUpgradedClient = "upgradedClient"
    36  
    37  	// KeyUpgradedConsState is the sub-key under which upgraded consensus state will be stored
    38  	KeyUpgradedConsState = "upgradedConsState"
    39  )
    40  
    41  // PlanKey is the key under which the current plan is saved
    42  // We store PlanByte as a const to keep it immutable (unlike a []byte)
    43  func PlanKey() []byte {
    44  	return []byte{PlanByte}
    45  }
    46  
    47  // UpgradedClientKey is the key under which the upgraded client state is saved
    48  // Connecting IBC chains can verify against the upgraded client in this path before
    49  // upgrading their clients
    50  func UpgradedClientKey(height int64) []byte {
    51  	return []byte(fmt.Sprintf("%s/%d/%s", KeyUpgradedIBCState, height, KeyUpgradedClient))
    52  }
    53  
    54  // UpgradedConsStateKey is the key under which the upgraded consensus state is saved
    55  // Connecting IBC chains can verify against the upgraded consensus state in this path before
    56  // upgrading their clients.
    57  func UpgradedConsStateKey(height int64) []byte {
    58  	return []byte(fmt.Sprintf("%s/%d/%s", KeyUpgradedIBCState, height, KeyUpgradedConsState))
    59  }