cosmos-sdk
cosmos-sdk copied to clipboard
Restart after automatic upgrade not working ( Module Add-Delete-Add )
Summary of Bug
After an automatic upgrade, if you stop the chain at height X and re-start it the following error is returned:
failed to load latest version: failed to load store: initial version set to X (upgradeHeight +1), but found earlier version 1
Version
Steps to Reproduce
I discovered this while exploring automatic upgrades and how it works in Cosmos SDK, and also to test if the upgrade works in particular situations/conditions.
Note: Please correct me if I'm missing anything here, I'm just exploring stuff and learning.
-
Initialize the dummy (foo) module in the chain.
- action - Chain started
- result - success
- reason - initialized a new module, assuming this is what needed to be on-chain with some basic features and states
-
Raise a software upgrade proposal; this proposal includes deletion of the (foo) module from the chain.
-
action - Chain restarted with upgraded binary, and without foo module
-
result - success
-
reason - a. This module wasn't properly written. b. Removal of all the states which are useless (or not needed anymore) c. The module has never been used d. The features provided by modules are not great.
-
eg.
-
storeUpgrades = &storetypes.StoreUpgrades{
Deleted: []string{"foo"}
}
app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, storeUpgrades))
- Raise a software upgrade proposal; this proposal includes re-adding (foo) module on-chain.
- action - Rebuild the binary, and start the chain
- result - error -
failed to load latest version: failed to load store: initial version set to 40, but found earlier version 1
- reason - a. Built from scratch again. b. New states, msgs, and queries. c. New features added.
- eg.
storeUpgrades = &storetypes.StoreUpgrades{
Added: []string{"foo"}
}
app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, storeUpgrades))
For Admin Use
- [ ] Not duplicate issue
- [ ] Appropriate labels applied
- [ ] Appropriate contributors tagged
- [ ] Contributor assigned/self-assigned