cosmos-sdk/x/upgrade/types/keys.go

60 lines
2.0 KiB
Go
Raw Normal View History

2019-11-08 06:40:56 -08:00
package types
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
x/upgrade: added consensus version tracking (part of ADR-041) (#8743) * -added consensus version tracking to x/upgrade * -added interface to module manager -added e2e test for migrations using consensus version store in x/upgrade -cleaned up x/upgrade Keeper -handler in apply upgrade now handles errors and setting consensus versions -cleaned up migration map keys -removed init chainer method -simapp now implements GetConsensusVersions to assist with testing * Changed MigrationMap identifier to VersionMap removed module_test * updated docs * forgot this * added line to changelog for this PR * Change set consensus version function to match adr 041 spec * add documentation * remove newline from changelog unnecessary newline removed * updated example in simapp for RunMigrations, SetCurrentConsensusVersions now returns an error * switch TestMigrations to use Require instead of t.Fatal * Update CHANGELOG.md Co-authored-by: Aaron Craelius <aaron@regen.network> * docs for SetVersionManager * -init genesis method added -removed panics/fails from setting consensus versions * update identifiers to be more go-like * update docs and UpgradeHandler fnc sig * Upgrade Keeper now takes a VersionMap instead of a VersionManager interface * upgrade keeper transition to Version Map * cleanup, added versionmap return to RunMigrations * quick fix * Update docs/architecture/adr-041-in-place-store-migrations.md Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com> * remove support for versionmap field on upgrade keeper * cleanup * rename get/set version map keeper functions * update adr doc to match name changes * remove redudant line Co-authored-by: technicallyty <48813565+tytech3@users.noreply.github.com> Co-authored-by: Aaron Craelius <aaron@regen.network> Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-03-19 15:01:29 -07:00
// VersionMapByte is a prefix to look up module names (key) and versions (value)
VersionMapByte = 0x2
// ProtocolVersionByte is a prefix to look up Protocol Version
ProtocolVersionByte = 0x3
// 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
KeyUpgradedClient = "upgradedClient"
// 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}
}
// 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
func UpgradedClientKey(height int64) []byte {
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))
}