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

Cosmovisor doesn't report its version properly #15360

Closed
freak12techno opened this issue Mar 10, 2023 · 9 comments
Closed

Cosmovisor doesn't report its version properly #15360

freak12techno opened this issue Mar 10, 2023 · 9 comments
Assignees
Labels
C:Cosmovisor Issues and PR related to Cosmovisor

Comments

@freak12techno
Copy link
Contributor

Summary of Bug

When running cosmovisor version it displays its version as (devel) instead of a proper version (like 1.4.0, the one I've tested it on).

validator@cosmos-validator ~/cosmos-sdk #tools/cosmovisor/v1.4.0 ?1 ❯ cosmovisor version
cosmovisor version: (devel)
11:16PM INF running app args=["version"] module=cosmovisor path=/home/validator/.gaia/cosmovisor/upgrades/v8-rho/bin/gaiad
v8.0.1

Version

validator@cosmos-validator ~/cosmos-sdk #tools/cosmovisor/v1.4.0 ?1 ❯ git status
HEAD detached at tools/cosmovisor/v1.4.0

Steps to Reproduce

  1. Run cosmovisor version
@github-actions github-actions bot added the needs-triage Issue that needs to be triaged label Mar 10, 2023
@freak12techno
Copy link
Contributor Author

Additionally I am facing the following when running it as --output json, not sure if that's related or it should be another issue.

validator@cosmos-validator ~/cosmos-sdk #tools/cosmovisor/v1.4.0 ?1 ❯ cosmovisor version --output json
{"name":"gaia","server_name":"gaiad","version":"v8.0.1","commit":"890ab3aa2e5788537b0d2ebc9bafdc968340e0e5","build_tags":"netgo ledger,","go":"go version go1.18.5 linux/amd64","build_deps":["cosmossdk.io/[email protected]","cosmossdk.io/[email protected]","cosmossdk.io/[email protected]","filippo.io/[email protected]","github.com/99designs/[email protected] =\u003e github.com/cosmos/[email protected]","github.com/ChainSafe/[email protected]","github.com/Workiva/[email protected]","github.com/armon/[email protected]","github.com/beorn7/[email protected]","github.com/bgentry/[email protected]","github.com/btcsuite/[email protected] =\u003e github.com/btcsuite/[email protected]","github.com/btcsuite/btcd/btcec/[email protected]","github.com/cenkalti/backoff/[email protected]","github.com/cespare/xxhash/[email protected]","github.com/coinbase/[email protected]","github.com/confio/ics23/[email protected] =\u003e github.com/confio/ics23/[email protected]","github.com/cosmos/[email protected]","github.com/cosmos/[email protected]","github.com/cosmos/[email protected]","github.com/cosmos/[email protected] =\u003e github.com/cosmos/[email protected]","github.com/cosmos/[email protected]","github.com/cosmos/[email protected]","github.com/cosmos/ibc-go/[email protected] =\u003e github.com/cosmos/ibc-go/[email protected]","github.com/cosmos/[email protected]","github.com/creachadair/[email protected]","github.com/davecgh/[email protected]","github.com/decred/dcrd/dcrec/secp256k1/[email protected]","github.com/desertbit/[email protected]","github.com/dvsekhvalnov/[email protected]","github.com/felixge/[email protected]","github.com/fsnotify/[email protected]","github.com/go-kit/[email protected]","github.com/go-kit/[email protected]","github.com/go-logfmt/[email protected]","github.com/godbus/[email protected]","github.com/gogo/[email protected]","github.com/gogo/[email protected] =\u003e github.com/regen-network/[email protected]","github.com/golang/[email protected]","github.com/golang/[email protected]","github.com/google/[email protected]","github.com/google/[email protected]","github.com/gorilla/[email protected]","github.com/gorilla/[email protected]","github.com/gorilla/[email protected]","github.com/gravity-devs/[email protected]","github.com/grpc-ecosystem/[email protected]","github.com/grpc-ecosystem/[email protected]","github.com/grpc-ecosystem/grpc-gateway/[email protected]","github.com/gsterjov/[email protected]","github.com/gtank/[email protected]","github.com/gtank/[email protected]","github.com/hashicorp/[email protected]","github.com/hashicorp/[email protected]","github.com/hashicorp/[email protected]","github.com/hdevalence/[email protected]","github.com/improbable-eng/[email protected]","github.com/klauspost/[email protected]","github.com/lib/[email protected]","github.com/libp2p/[email protected]","github.com/magiconair/[email protected]","github.com/mattn/[email protected]","github.com/mattn/[email protected]","github.com/matttproud/[email protected]","github.com/mimoo/[email protected]","github.com/minio/[email protected]","github.com/mitchellh/[email protected]","github.com/mtibben/[email protected]","github.com/pelletier/go-toml/[email protected]","github.com/pkg/[email protected]","github.com/pmezard/[email protected]","github.com/prometheus/[email protected]","github.com/prometheus/[email protected]","github.com/prometheus/[email protected]","github.com/prometheus/[email protected]","github.com/rakyll/[email protected]","github.com/rcrowley/[email protected]","github.com/regen-network/[email protected]","github.com/rs/[email protected]","github.com/rs/[email protected]","github.com/spf13/[email protected]","github.com/spf13/[email protected]","github.com/spf13/[email protected]","github.com/spf13/[email protected]","github.com/spf13/[email protected]","github.com/spf13/[email protected]","github.com/strangelove-ventures/packet-forward-middleware/[email protected]","github.com/stretchr/[email protected]","github.com/subosito/[email protected]","github.com/syndtr/[email protected]","github.com/tendermint/[email protected]","github.com/tendermint/[email protected] =\u003e github.com/informalsystems/[email protected]","github.com/tendermint/[email protected]","github.com/tidwall/[email protected]","github.com/zondax/[email protected]","github.com/zondax/[email protected]","golang.org/x/[email protected]","golang.org/x/[email protected]","golang.org/x/[email protected]","golang.org/x/[email protected]","golang.org/x/[email protected]","golang.org/x/[email protected]","google.golang.org/[email protected]","google.golang.org/[email protected] =\u003e google.golang.org/[email protected]","google.golang.org/[email protected]","gopkg.in/[email protected]","gopkg.in/[email protected]","gopkg.in/[email protected]","nhooyr.io/[email protected]"],"cosmos_sdk_version":"v0.45.14"}
Error: can't print version output, expected valid json from APP, got:  - json: error calling MarshalJSON for type json.RawMessage: unexpected end of JSON input
11:12PM ERR error="can't print version output, expected valid json from APP, got:  - json: error calling MarshalJSON for type json.RawMessage: unexpected end of JSON input" module=cosmovisor

@julienrbrt
Copy link
Member

julienrbrt commented Mar 11, 2023

How have you installed cosmovisor?
Can you try to install it using go install?

$ go install cosmossdk.io/tools/cosmovisor/cmd/[email protected]
$ DAEMON_NAME=simd DAEMON_HOME=~/.simapp DAEMON_DATA_BACK_DIR=~/.simapp/bak cosmovisor version
cosmovisor version: v1.4.0
...

@julienrbrt julienrbrt added S:needs more info This bug can't be addressed until more information is provided by the reporter. C:Cosmovisor Issues and PR related to Cosmovisor and removed needs-triage Issue that needs to be triaged labels Mar 11, 2023
@julienrbrt
Copy link
Member

Additionally I am facing the following when running it as --output json, not sure if that's related or it should be another issue.

For the second point, this is related to gaia not returning a valid JSON and not to Cosmovisor

@freak12techno
Copy link
Contributor Author

@julienrbrt

How have you installed cosmovisor?

I compiled it from source, like described here: https://docs.cosmos.network/main/tooling/cosmovisor#installation.

Can you try to install it using go install?

Just tested it, got the same result as you did. I assume that this is not working only when compiling Cosmovisor from source then. It was totally working before though, I've seen some changes where the version injected into app from ldflags was removed and ReadBuildInfo was used instead, my assumption is that it was broken at that time.

For the second point, this is related to gaia not returning a valid JSON and not to Cosmovisor

Seems not, I also have it on other nodes, for example this is bitsong (also compiled from source):

$ cosmovisor version --output json
{"name":"go-bitsong","server_name":"bitsongd","version":"0.14.0","commit":"e5847ac0b4f0319811d62140f4e438d33163ad0d","build_tags":"netgo,ledger","go":"go version go1.19.3 linux/amd64","build_deps":["filippo.io/[email protected]","github.com/99designs/[email protected]","github.com/ChainSafe/[email protected]","github.com/CosmWasm/[email protected]","github.com/CosmWasm/[email protected]","github.com/Workiva/[email protected]","github.com/armon/[email protected]","github.com/beorn7/[email protected]","github.com/bgentry/[email protected]","github.com/btcsuite/[email protected]","github.com/cespare/xxhash/[email protected]","github.com/coinbase/[email protected]","github.com/confio/ics23/[email protected] =\u003e github.com/cosmos/cosmos-sdk/ics23/[email protected]","github.com/cosmos/[email protected]","github.com/cosmos/[email protected]","github.com/cosmos/[email protected]","github.com/cosmos/[email protected]","github.com/cosmos/[email protected]","github.com/cosmos/[email protected]","github.com/cosmos/ibc-go/[email protected]","github.com/cosmos/[email protected]","github.com/cosmos/[email protected]","github.com/creachadair/[email protected]","github.com/davecgh/[email protected]","github.com/desertbit/[email protected]","github.com/dvsekhvalnov/[email protected]","github.com/felixge/[email protected]","github.com/fsnotify/[email protected]","github.com/go-kit/[email protected]","github.com/go-kit/[email protected]","github.com/go-logfmt/[email protected]","github.com/godbus/[email protected]","github.com/gogo/[email protected]","github.com/gogo/[email protected] =\u003e github.com/regen-network/[email protected]","github.com/golang/[email protected]","github.com/golang/[email protected]","github.com/google/[email protected]","github.com/google/[email protected]","github.com/google/[email protected]","github.com/gorilla/[email protected]","github.com/gorilla/[email protected]","github.com/gorilla/[email protected]","github.com/grpc-ecosystem/[email protected]","github.com/grpc-ecosystem/[email protected]","github.com/gsterjov/[email protected]","github.com/gtank/[email protected]","github.com/gtank/[email protected]","github.com/hashicorp/[email protected]","github.com/hashicorp/[email protected]","github.com/hashicorp/[email protected]","github.com/hdevalence/[email protected]","github.com/improbable-eng/[email protected]","github.com/klauspost/[email protected]","github.com/lib/[email protected]","github.com/libp2p/[email protected]","github.com/magiconair/[email protected]","github.com/mattn/[email protected]","github.com/mattn/[email protected]","github.com/matttproud/[email protected]","github.com/mimoo/[email protected]","github.com/minio/[email protected]","github.com/mitchellh/[email protected]","github.com/mtibben/[email protected]","github.com/pelletier/go-toml/[email protected]","github.com/pkg/[email protected]","github.com/pmezard/[email protected]","github.com/prometheus/[email protected]","github.com/prometheus/[email protected]","github.com/prometheus/[email protected]","github.com/prometheus/[email protected]","github.com/rakyll/[email protected]","github.com/rcrowley/[email protected]","github.com/regen-network/[email protected]","github.com/rs/[email protected]","github.com/rs/[email protected]","github.com/spf13/[email protected]","github.com/spf13/[email protected]","github.com/spf13/[email protected]","github.com/spf13/[email protected]","github.com/spf13/[email protected]","github.com/spf13/[email protected]","github.com/strangelove-ventures/packet-forward-middleware/[email protected]","github.com/stretchr/[email protected]","github.com/subosito/[email protected]","github.com/syndtr/[email protected]","github.com/tendermint/[email protected]","github.com/tendermint/[email protected]","github.com/tendermint/[email protected]","github.com/tendermint/[email protected]","github.com/tendermint/[email protected]","github.com/zondax/[email protected]","golang.org/x/[email protected]","golang.org/x/[email protected]","golang.org/x/[email protected]","golang.org/x/[email protected]","golang.org/x/[email protected]","golang.org/x/[email protected]","google.golang.org/[email protected]","google.golang.org/[email protected] =\u003e google.golang.org/[email protected]","google.golang.org/[email protected]","gopkg.in/[email protected]","gopkg.in/[email protected]","gopkg.in/[email protected]","nhooyr.io/[email protected]"],"cosmos_sdk_version":"v0.45.11"}
Error: can't print version output, expected valid json from APP, got:  - json: error calling MarshalJSON for type json.RawMessage: unexpected end of JSON input
11:41PM ERR error="can't print version output, expected valid json from APP, got:  - json: error calling MarshalJSON for type json.RawMessage: unexpected end of JSON input" module=cosmovisor

I am not sure whether these bitsongd/gaiad daemons are writing to stderr or stdout though.

@julienrbrt
Copy link
Member

Oh yes, we wanted to make it work with go install, in a more "automatic" fashion so using ReadBuildInfo was perfect.
So it is probably why it shows devel when building from source.

On your second point I am not sure. Does it work for you too with simapp? I know Gaia had some inconsistencies with where some commands were returning (seen a issue recently on their repo about that).

@freak12techno
Copy link
Contributor Author

@julienrbrt

Oh yes, we wanted to make it work with go install, in a more "automatic" fashion so using ReadBuildInfo was perfect.
So it is probably why it shows devel when building from source.

I guess it makes sense to either deprecate building from binary or make it work properly for binaries built from source, what do you think?

On your second point I am not sure. Does it work for you too with simapp? I know Gaia had some inconsistencies with where some commands were returning (seen a issue recently on their repo about that).

Actually just tested and it seem to work file with simd:

➜  cosmos-sdk git:(main) DAEMON_NAME=simd DAEMON_HOME=~/.simapp DAEMON_DATA_BACK_DIR=~/.simapp/bak cosmovisor version --output json
{"cosmovisor_version":"v1.4.0","app_version":{"name":"sim","server_name":"simd","version":"0.46.0-beta2-1616-g00154fec3","commit":"00154fec385c6e1b3242b2c5bd785bc1b419f153","build_tags":"netgo,ledger","go":"go version go1.19.6 darwin/arm64","build_deps":["cloud.google.com/[email protected]","cloud.google.com/go/compute/[email protected]","cloud.google.com/go/[email protected]","cloud.google.com/go/[email protected]","cosmossdk.io/[email protected]","cosmossdk.io/client/[email protected]","cosmossdk.io/[email protected]","cosmossdk.io/[email protected]","cosmossdk.io/[email protected]","cosmossdk.io/[email protected]","cosmossdk.io/[email protected]","cosmossdk.io/[email protected]","cosmossdk.io/[email protected]","cosmossdk.io/tools/[email protected] =\u003e ../tools/confix@(devel)","cosmossdk.io/tools/[email protected] =\u003e ../tools/rosetta@(devel)","cosmossdk.io/x/[email protected] =\u003e ../x/evidence@(devel)","cosmossdk.io/x/[email protected] =\u003e ../x/feegrant@(devel)","cosmossdk.io/x/[email protected] =\u003e ../x/nft@(devel)","cosmossdk.io/x/[email protected]","cosmossdk.io/x/[email protected] =\u003e ../x/upgrade@(devel)","filippo.io/[email protected]","github.com/99designs/[email protected]","github.com/99designs/[email protected] =\u003e github.com/cosmos/[email protected]","github.com/ChainSafe/[email protected]","github.com/armon/[email protected]","github.com/aws/[email protected]","github.com/beorn7/[email protected]","github.com/bgentry/[email protected]","github.com/bgentry/[email protected]","github.com/btcsuite/btcd/btcec/[email protected]","github.com/cenkalti/backoff/[email protected]","github.com/cespare/xxhash/[email protected]","github.com/chzyer/[email protected]","github.com/cockroachdb/apd/[email protected]","github.com/cockroachdb/[email protected]","github.com/cockroachdb/[email protected]","github.com/cockroachdb/[email protected]","github.com/coinbase/rosetta-sdk-go/[email protected]","github.com/cometbft/[email protected]","github.com/cometbft/[email protected]","github.com/confio/ics23/[email protected]","github.com/cosmos/[email protected]","github.com/cosmos/[email protected]","github.com/cosmos/[email protected]","github.com/cosmos/[email protected] =\u003e ../.@(devel)","github.com/cosmos/[email protected]","github.com/cosmos/[email protected]","github.com/cosmos/[email protected]","github.com/cosmos/[email protected]","github.com/cosmos/[email protected]","github.com/cosmos/[email protected]","github.com/creachadair/[email protected]","github.com/creachadair/[email protected]","github.com/creachadair/[email protected]","github.com/davecgh/[email protected]","github.com/decred/dcrd/dcrec/secp256k1/[email protected]","github.com/desertbit/[email protected]","github.com/dvsekhvalnov/[email protected]","github.com/felixge/[email protected]","github.com/fsnotify/[email protected]","github.com/getsentry/[email protected]","github.com/go-kit/[email protected]","github.com/go-kit/[email protected]","github.com/go-logfmt/[email protected]","github.com/gogo/[email protected]","github.com/gogo/[email protected]","github.com/golang/[email protected]","github.com/golang/[email protected]","github.com/golang/[email protected]","github.com/golang/[email protected]","github.com/google/[email protected]","github.com/google/[email protected]","github.com/google/[email protected]","github.com/google/[email protected]","github.com/googleapis/[email protected]","github.com/googleapis/gax-go/[email protected]","github.com/gorilla/[email protected]","github.com/gorilla/[email protected]","github.com/gorilla/[email protected]","github.com/grpc-ecosystem/[email protected]","github.com/grpc-ecosystem/[email protected]","github.com/gtank/[email protected]","github.com/gtank/[email protected]","github.com/hashicorp/[email protected]","github.com/hashicorp/[email protected]","github.com/hashicorp/[email protected]","github.com/hashicorp/[email protected]","github.com/hashicorp/[email protected]","github.com/hashicorp/[email protected]","github.com/hashicorp/[email protected]","github.com/hdevalence/[email protected]","github.com/huandu/[email protected]","github.com/improbable-eng/[email protected]","github.com/jmespath/[email protected]","github.com/klauspost/[email protected]","github.com/kr/[email protected]","github.com/kr/[email protected]","github.com/lib/[email protected]","github.com/libp2p/[email protected]","github.com/magiconair/[email protected]","github.com/manifoldco/[email protected]","github.com/mattn/[email protected]","github.com/mattn/[email protected]","github.com/matttproud/[email protected]","github.com/mimoo/[email protected]","github.com/minio/[email protected]","github.com/mitchellh/[email protected]","github.com/mitchellh/[email protected]","github.com/mitchellh/[email protected]","github.com/mtibben/[email protected]","github.com/pelletier/go-toml/[email protected]","github.com/pkg/[email protected]","github.com/pmezard/[email protected]","github.com/prometheus/[email protected]","github.com/prometheus/[email protected]","github.com/prometheus/[email protected]","github.com/prometheus/[email protected]","github.com/rcrowley/[email protected]","github.com/rogpeppe/[email protected]","github.com/rs/[email protected]","github.com/rs/[email protected]","github.com/spf13/[email protected]","github.com/spf13/[email protected]","github.com/spf13/[email protected]","github.com/spf13/[email protected]","github.com/spf13/[email protected]","github.com/spf13/[email protected]","github.com/stretchr/[email protected]","github.com/subosito/[email protected]","github.com/syndtr/[email protected] =\u003e github.com/syndtr/[email protected]","github.com/tendermint/[email protected]","github.com/tidwall/[email protected]","github.com/ulikunitz/[email protected]","github.com/zondax/[email protected]","github.com/zondax/[email protected]","[email protected]","golang.org/x/[email protected]","golang.org/x/[email protected]","golang.org/x/[email protected]","golang.org/x/[email protected]","golang.org/x/[email protected]","golang.org/x/[email protected]","golang.org/x/[email protected]","golang.org/x/[email protected]","golang.org/x/[email protected]","google.golang.org/[email protected]","google.golang.org/[email protected]","google.golang.org/[email protected]","google.golang.org/[email protected]","gopkg.in/[email protected]","gopkg.in/[email protected]","gopkg.in/[email protected]","gotest.tools/[email protected]","nhooyr.io/[email protected]","pgregory.net/[email protected]","sigs.k8s.io/[email protected]"],"cosmos_sdk_version":"v0.48.0"}}

On the other hand I just noticed I have some chains that have it working (emoney, simd, jackal) and some have it not working (gaia, bitsong, decentr, sentinel). Wonder if it has something to do with cosmos-sdk version, not sure about it.

@julienrbrt julienrbrt self-assigned this Mar 12, 2023
@julienrbrt
Copy link
Member

I think this is fine, given that it works as intended with go install, which is the way we advise to install our tooling (everything under tools/). The fact it shows devel seems to be an issue when using go build (golang/go#29228).

I can add a disclaimer in the docs.

@freak12techno
Copy link
Contributor Author

I can add a disclaimer in the docs.

I'm all in, my concern here is that one of the officially recommended ways of installing it is by building from source, so it's nice to have it noted somewhere that the versioning won't work in that case. Adding a disclaimer would work I guess.

On the other issue I've mentioned here in comments, should I open another issue on this repository or it isn't something to be fixed and should be rather asked to be fixed by the chain maintainers for the chains it doesn't work properly with?

@julienrbrt
Copy link
Member

Right, I've added a disclaimer for that, so it is more clear go install is the way to install our tooling.

On the other issue I've mentioned here in comments, should I open another issue on this repository or it isn't something to be fixed and should be rather asked to be fixed by the chain maintainers for the chains it doesn't work properly with?

Given that it works with (latest) simapp v0.45, (latest) simapp v0.46, (latest) simapp v0.47 and (latest) simapp from main,
this is indeed something for the chain maintainers to verify that they have the following in their persistentPreRunE of their rootCmd:

// set the default command outputs
cmd.SetOut(cmd.OutOrStdout())
cmd.SetErr(cmd.ErrOrStderr())

@julienrbrt julienrbrt added T:Sprint and removed S:needs more info This bug can't be addressed until more information is provided by the reporter. T:Sprint labels Mar 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:Cosmovisor Issues and PR related to Cosmovisor
Projects
None yet
Development

No branches or pull requests

2 participants