Skip to content
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

gaia panic in local test: cannot delete latest saved version upon upgrade #1088

Closed
3 tasks
yaruwangway opened this issue Mar 9, 2022 · 2 comments · Fixed by #1091
Closed
3 tasks

gaia panic in local test: cannot delete latest saved version upon upgrade #1088

yaruwangway opened this issue Mar 9, 2022 · 2 comments · Fixed by #1091
Assignees
Labels
type: bug Something isn't working as expected

Comments

@yaruwangway
Copy link

Summary of Bug

Gaia upgrade from v6 to a binary built from theta-prepare branch in local test according to this tutorial.

panic upon upgrade height:

panic: cannot delete latest saved version (8)

goroutine 1 [running]:
github.com/cosmos/cosmos-sdk/store/rootmulti.(*Store).pruneStores(0x140010bd080)
	/Users/yaruwang/go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.45.1/store/rootmulti/store.go:430 +0x210
github.com/cosmos/cosmos-sdk/store/rootmulti.(*Store).Commit(0x140010bd080)
	/Users/yaruwang/go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.45.1/store/rootmulti/store.go:404 +0x184
github.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).Commit(0x1400122dba0)
	/Users/yaruwang/go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.45.1/baseapp/abci.go:308 +0x210
github.com/tendermint/tendermint/abci/client.(*localClient).CommitSync(0x14000244ea0)
	/Users/yaruwang/go/pkg/mod/github.com/tendermint/tendermint@v0.34.14/abci/client/local_client.go:264 +0xec
github.com/tendermint/tendermint/proxy.(*appConnConsensus).CommitSync(0x1400126ede0)
	/Users/yaruwang/go/pkg/mod/github.com/tendermint/tendermint@v0.34.14/proxy/app_conn.go:93 +0x34
github.com/tendermint/tendermint/state.(*BlockExecutor).Commit(0x14000d612d0, {{{0xb, 0x0}, {0x14000d5cd28, 0x8}}, {0x14000d5cd80, 0xe}, 0x89dbae, 0x89dc1c, {{0x140010e2c20, ...}, ...}, ...}, ...)
	/Users/yaruwang/go/pkg/mod/github.com/tendermint/tendermint@v0.34.14/state/execution.go:228 +0x1b8
github.com/tendermint/tendermint/state.(*BlockExecutor).ApplyBlock(0x14000d612d0, {{{0xb, 0x0}, {0x14000d5cd28, 0x8}}, {0x14000d5cd80, 0xe}, 0x89dbae, 0x89dc1c, {{0x140010e2c20, ...}, ...}, ...}, ...)
	/Users/yaruwang/go/pkg/mod/github.com/tendermint/tendermint@v0.34.14/state/execution.go:180 +0x598
github.com/tendermint/tendermint/consensus.(*Handshaker).replayBlock(0x14000fc7dc0, {{{0xb, 0x0}, {0x14000d5cd28, 0x8}}, {0x14000d5cd80, 0xe}, 0x89dbae, 0x89dc1b, {{0x14000f60320, ...}, ...}, ...}, ...)
	/Users/yaruwang/go/pkg/mod/github.com/tendermint/tendermint@v0.34.14/consensus/replay.go:503 +0x1a8
github.com/tendermint/tendermint/consensus.(*Handshaker).ReplayBlocks(0x14000f85dc0, {{{0xb, 0x0}, {0x14000d5cd28, 0x8}}, {0x14000d5cd80, 0xe}, 0x89dbae, 0x89dc1b, {{0x14000f60320, ...}, ...}, ...}, ...)
	/Users/yaruwang/go/pkg/mod/github.com/tendermint/tendermint@v0.34.14/consensus/replay.go:416 +0x6d0
github.com/tendermint/tendermint/consensus.(*Handshaker).Handshake(0x14000fc7dc0, {0x1028a61e0, 0x14000036a90})
	/Users/yaruwang/go/pkg/mod/github.com/tendermint/tendermint@v0.34.14/consensus/replay.go:268 +0x400
github.com/tendermint/tendermint/node.doHandshake({0x10289ec90, 0x140005a0770}, {{{0xb, 0x0}, {0x14000d5cd28, 0x8}}, {0x14000d5cd80, 0xe}, 0x89dbae, 0x89dc1b, ...}, ...)
	/Users/yaruwang/go/pkg/mod/github.com/tendermint/tendermint@v0.34.14/node/node.go:325 +0x114
github.com/tendermint/tendermint/node.NewNode(0x14001117cc0, {0x10285b378, 0x14001273540}, 0x140005a0940, {0x10283dbc0, 0x14000f669a8}, 0x140005a09d0, 0x102817868, 0x140005a0ae0, {0x10287ddc0, ...}, ...)
	/Users/yaruwang/go/pkg/mod/github.com/tendermint/tendermint@v0.34.14/node/node.go:733 +0x510
github.com/cosmos/cosmos-sdk/server.startInProcess(0x1400115dde0, {{0x0, 0x0, 0x0}, {0x1028b3058, 0x1400120d7a0}, {0x14001223f50, 0xe}, {0x1028861c0, 0x140010e1b70}, ...}, ...)
	/Users/yaruwang/go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.45.1/server/start.go:263 +0x768
github.com/cosmos/cosmos-sdk/server.StartCmd.func2(0x1400117ec80, {0x1400121a780, 0x0, 0x1})
	/Users/yaruwang/go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.45.1/server/start.go:129 +0x144
github.com/spf13/cobra.(*Command).execute(0x1400117ec80, {0x1400121a770, 0x1, 0x1})
	/Users/yaruwang/go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:856 +0x668
github.com/spf13/cobra.(*Command).ExecuteC(0x14000e45b80)
	/Users/yaruwang/go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:974 +0x410
github.com/spf13/cobra.(*Command).Execute(...)
	/Users/yaruwang/go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:902
github.com/spf13/cobra.(*Command).ExecuteContext(...)
	/Users/yaruwang/go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:895
github.com/cosmos/cosmos-sdk/server/cmd.Execute(0x14000e45b80, {0x140010fc2a0, 0x15})
	/Users/yaruwang/go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.45.1/server/cmd/execute.go:36 +0x23c
main.main()
	/Users/yaruwang/code/gaia/cmd/gaiad/main.go:16 +0x3c
5:40PM WRN Use of cosmovisor without the 'run' command is deprecated. Use: cosmovisor run [args] module=cosmovisor

if in theta-prepare branch, I change the ibc-go version from rc-1 to rc-0, I will have the same panic cannot delete latest saved version after upgrade and produce a few blocks.

the panic is from iavl tree, https://github.com/cosmos/iavl/blob/d99448032e95a6ce05d342737cd745a20ef0b6ce/mutable_tree.go#L568

How to avoid the above panic?

  1. if I delete ica module in the upgradehandler, https://github.com/cosmos/gaia/blob/619e66e3104e03bcf320fb37cc663e5e37da7d32/app/app.go#L655-L668, i can upgrade without panic.

  2. Hypha sets pruning="nothing" in app.toml, also can upgrade without panic.
    add initial details about theta testnet testnets#301 (comment)

  3. use "fresh" genesis, which means use gaia init to generate genesis, rather than use the exported genesis from livehub, this can also upgrade without panic.
    add initial details about theta testnet testnets#301 (comment)

Version

Steps to Reproduce

Gaia upgrade from v6 to a binary built from theta-prepare branch in local test according to this tutorial.


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged/assigned
@yaruwangway yaruwangway changed the title gaia panic: cannot delete latest saved version gaia panic in local test: cannot delete latest saved version upon upgrade Mar 9, 2022
@crodriguezvega crodriguezvega added the type: bug Something isn't working as expected label Mar 9, 2022
@yaruwangway
Copy link
Author

solved, thank you @colin-axner
the issue is when addding upgrade store, i need to add Added: []string{icacontrollertypes.StoreKey, icahosttypes.StoreKey} both substores, not the module Added: []string{icatypes.ModuleName},
The reason:
loadVersion will check the store upgrades when initializing the stores
https://github.com/cosmos/cosmos-sdk/blob/master/store/rootmulti/store.go#L218-#L228

@colin-axner
Copy link
Contributor

Following up with more information:

The issue is that StoreUpgrades is actually initializing the stores with appropriate versions for modules which are added during an upgrade. It loops over the store keys set in the params and checks if the upgrades.IsAdded(key)

The bug here is that we were recommending the icatypes.ModuleName to be set in StoreUpgrades. We don't have a store key for icatypes.ModuleName, we have 2 stores, one for controller and one for host. So really the StoreUpgrades should be:

    Added: []string{icacontrollertypes.StoreKey, icahosttypes.StoreKey},

So the loadVersion is looping over existing store keys and checking if they are in storeUpgrades (which controller/host weren't and thus the initialVersion was never being set. I'm unsure why it doesn't error until the height tries to be pruned. I'm guessing initial version defaults to 0 and maybe when it pruning it prunes only on stores with an initial version < pruning height, but in reality the initial version of our stores aren't created until after pruning height and thus there is nothing to prune

CosmosCar pushed a commit to caelus-labs/ibc-go that referenced this issue Nov 6, 2023
Bumps [rollkit/.github](https://github.com/rollkit/.github) from 0.1.1
to 0.2.2.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/rollkit/.github/releases">rollkit/.github's
releases</a>.</em></p>
<blockquote>
<h2>v0.2.2</h2>
<h2>Overview</h2>
<p>Bring in updates from Celestia/.github</p>
<h2>What's Changed</h2>
<ul>
<li>add issue template by <a
href="https://github.com/MSevey"><code>@​MSevey</code></a> in <a
href="https://github.com/rollkit/.github/pull/6">rollkit/.github#6</a></li>
<li>Delete dependabot.yml by <a
href="https://github.com/MSevey"><code>@​MSevey</code></a> in <a
href="https://github.com/rollkit/.github/pull/5">rollkit/.github#5</a></li>
<li>Celestia updates by <a
href="https://github.com/MSevey"><code>@​MSevey</code></a> in <a
href="https://github.com/rollkit/.github/pull/8">rollkit/.github#8</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/rollkit/.github/compare/v0.1.1...v0.2.2">https://github.com/rollkit/.github/compare/v0.1.1...v0.2.2</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/rollkit/.github/commit/b761dcfaa1e1ae9ece8f820855f538d9423ba829"><code>b761dcf</code></a>
Celestia updates (<a
href="https://github.com/rollkit/.github/issues/8">#8</a>)</li>
<li><a
href="https://github.com/rollkit/.github/commit/4405cc654fbb65b4eae5fa3abcbb556b079ff899"><code>4405cc6</code></a>
Delete dependabot.yml (<a
href="https://github.com/rollkit/.github/issues/5">#5</a>)</li>
<li><a
href="https://github.com/rollkit/.github/commit/de7084918e20fc75de3962eff0a05b989a66b880"><code>de70849</code></a>
add issue template (<a
href="https://github.com/rollkit/.github/issues/6">#6</a>)</li>
<li>See full diff in <a
href="https://github.com/rollkit/.github/compare/v0.1.1...v0.2.2">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=rollkit/.github&package-manager=github_actions&previous-version=0.1.1&new-version=0.2.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working as expected
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants