Repository navigation
Conversation
…he blockstore
When the daemon has exited, checkHeight reads the height from the
blockstore itself and takes the backend from
`<daemon> config get config db_backend`. That command prints the value
TOML-encoded ("goleveldb" with quotes and a trailing newline), and the
raw output was passed to dbm.NewDB, which rejects it. The height check
then fails and the upgrade is not taken.
Decode the value strictly (bare, basic or literal TOML string, one line)
and leave backend validation to dbm.NewDB.
Contributor
|
PR author is not in the allowed authors list. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When the daemon has already exited,
fileWatcher.checkHeightreads the current height from the CometBFT blockstore itself. It gets the backend name from<daemon> config get config db_backendand passes the raw output todbm.NewDB. Current SDK versions print that value TOML-encoded, as"goleveldb"with quotes and a trailing newline.dbm.NewDBrejects it,checkHeightreturns an error, andCheckUpdatereturns false. The upgrade is then missed: cosmovisor restarts the old binary instead of switching.This PR adds
parseDBBackend, which strictly decodes the command output:"...") or a TOML literal string ('...'), on a single line, with surrounding whitespace allowed.[a-z0-9_].dbm.NewDBstill decides that.The fallback to
goleveldbwhen the config command fails is unchanged.Files to review:
tools/cosmovisor/dbbackend.go(the parser), and thecheckHeightcall site intools/cosmovisor/scanner.go.Testing
TestParseDBBackendintools/cosmovisor/dbbackend_test.gocovers the quoted, literal, bare and whitespace forms, plus each rejection case.go test ./...intools/cosmovisorpasses, and so doesgolangci-lintwith the repository config.upgrade-info.json. cosmovisor v1.7.3 stays on the genesis binary. With this change it switches to the upgrade binary, and the upgraded node produces blocks.