-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
panic: cannot delete latest saved version #14625
Comments
this is usually done by an incorrect upgrade of adding a store where the store version is not the same as the others. We should really fix that |
I feel you, we probably shouldn't separate the stores into multiple trees in the first place. |
I think if we follow the invariant that store versions are always equal to the block height, then adding a store could set the if upgrades.IsAdded(key.Name()) {
storeParams.initialVersion = uint64(ver) + 1
} That could simplify the |
Yes! I've been advocating for a single logical DB/tree for ages now. It also gives us atomicity. However, this is technically orthogonal to the issue described here. We will be discussing this in the storage WG though! @tac0turtle we should combine #13933 and this issue into a single issue (I have no preference on which we close or even just create a new one). As pointed out by @k-yang and others, I believe the simple solution here to have the root MS ensure that whenever a new module store is discovered, it is loaded/saved with the current block height and not I think (?) #14410 is going to do this but I'm not sure. cc @catShaark |
@alexanderbez, so my PR will add validation in the |
Summary of Bug
We performed a chain upgrade. The chain upgrade added a new module. We registered the
UpgradeHandler
but forgot to add the module to theStoreUpgrades
(see NibiruChain/nibiru@b986c49).When we started the new binary, it tried to Prune previous versions of the store, and we ended up with the error
panic: cannot delete latest saved version (718)
. We knew something was wrong because we our upgrade height is 2460000. It means the store was loaded with aninitialVersion
less than theupgradeHeight
.Here is the full stack trace.
We read through cosmos/ibc-go#1088 and #8265 and added the module to
StoreUpgrades
(see NibiruChain/nibiru@0c1bd2e). We ran this binary and obtained the following error message:which indicates that the new store we're trying to add was already persisted disk by the earlier binary run.
We can continue our chain by setting
pruning = "nothing"
but this is undesirable because it effectively turns our node into a full archive node.We are at an impasse because the earlier binary run persisted the store to disk with
initialVersion=0
, preventing us from pruning fromheight=2460000
, and we are no longer able to add the module toStoreUpgrades.
In my opinion, the Cosmos SDK shouldn't persist stores to disk unless the
StoreUpgrades
array is explicitly given.Version
We use v0.45.10 of the Cosmos SDK.
Steps to Reproduce
The text was updated successfully, but these errors were encountered: