Browse Source

version: revert version through ldflag only (#6494)

## Description

Add version back to versions, but allow it to be overridden via a ldflag.

Reason:

Many users are not setting the ldflag causing issues with tooling that relies on it (cosmjs)

closes #6488

cc @webmaster128
pull/6503/head
Marko 4 years ago
committed by GitHub
parent
commit
1709e49813
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 18 additions and 12 deletions
  1. +2
    -0
      CHANGELOG_PENDING.md
  2. +2
    -0
      CONTRIBUTING.md
  3. +1
    -1
      Makefile
  4. +1
    -1
      cmd/tendermint/commands/version.go
  5. +3
    -3
      node/setup.go
  6. +1
    -1
      proxy/version.go
  7. +1
    -1
      state/state.go
  8. +1
    -1
      statesync/syncer_test.go
  9. +1
    -1
      tools/tm-signer-harness/main.go
  10. +5
    -3
      version/version.go

+ 2
- 0
CHANGELOG_PENDING.md View File

@ -25,6 +25,8 @@ Friendly reminder: We have a [bug bounty program](https://hackerone.com/tendermi
- [ABCI] \#5447 Remove `SetOption` method from `ABCI.Client` interface - [ABCI] \#5447 Remove `SetOption` method from `ABCI.Client` interface
- [ABCI] \#5447 Reset `Oneof` indexes for `Request` and `Response`. - [ABCI] \#5447 Reset `Oneof` indexes for `Request` and `Response`.
- [ABCI] \#5818 Use protoio for msg length delimitation. Migrates from int64 to uint64 length delimiters. - [ABCI] \#5818 Use protoio for msg length delimitation. Migrates from int64 to uint64 length delimiters.
- [Version] \#6494 `TMCoreSemVer` has been renamed to `TMVersion`.
- It is not required any longer to set ldflags to set version strings
- P2P Protocol - P2P Protocol


+ 2
- 0
CONTRIBUTING.md View File

@ -245,6 +245,7 @@ If there were no release candidates, and you'd like to cut a major release direc
all PRs all PRs
- Ensure that UPGRADING.md is up-to-date and includes notes on any breaking changes - Ensure that UPGRADING.md is up-to-date and includes notes on any breaking changes
or other upgrading flows. or other upgrading flows.
- Bump TMVersionDefault version in `version.go`
- Bump P2P and block protocol versions in `version.go`, if necessary - Bump P2P and block protocol versions in `version.go`, if necessary
- Bump ABCI protocol version in `version.go`, if necessary - Bump ABCI protocol version in `version.go`, if necessary
- Add any release notes you would like to be added to the body of the release to `release_notes.md`. - Add any release notes you would like to be added to the body of the release to `release_notes.md`.
@ -272,6 +273,7 @@ If there were no release candidates, and you'd like to cut a major release direc
release, and add the github aliases of external contributors to the top of release, and add the github aliases of external contributors to the top of
the changelog. To lookup an alias from an email, try `bash ./scripts/authors.sh <email>` the changelog. To lookup an alias from an email, try `bash ./scripts/authors.sh <email>`
- Reset the `CHANGELOG_PENDING.md` - Reset the `CHANGELOG_PENDING.md`
- Bump TMVersionDefault version in `version.go`
- Bump P2P and block protocol versions in `version.go`, if necessary - Bump P2P and block protocol versions in `version.go`, if necessary
- Bump ABCI protocol version in `version.go`, if necessary - Bump ABCI protocol version in `version.go`, if necessary
- Make sure all significant breaking changes are covered in `UPGRADING.md` - Make sure all significant breaking changes are covered in `UPGRADING.md`


+ 1
- 1
Makefile View File

@ -12,7 +12,7 @@ else
VERSION := $(shell git describe) VERSION := $(shell git describe)
endif endif
LD_FLAGS = -X github.com/tendermint/tendermint/version.TMCoreSemVer=$(VERSION)
LD_FLAGS = -X github.com/tendermint/tendermint/version.TMVersion=$(VERSION)
BUILD_FLAGS = -mod=readonly -ldflags "$(LD_FLAGS)" BUILD_FLAGS = -mod=readonly -ldflags "$(LD_FLAGS)"
HTTPS_GIT := https://github.com/tendermint/tendermint.git HTTPS_GIT := https://github.com/tendermint/tendermint.git
DOCKER_BUF := docker run -v $(shell pwd):/workspace --workdir /workspace bufbuild/buf DOCKER_BUF := docker run -v $(shell pwd):/workspace --workdir /workspace bufbuild/buf


+ 1
- 1
cmd/tendermint/commands/version.go View File

@ -13,6 +13,6 @@ var VersionCmd = &cobra.Command{
Use: "version", Use: "version",
Short: "Show version info", Short: "Show version info",
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
fmt.Println(version.TMCoreSemVer)
fmt.Println(version.TMVersion)
}, },
} }

+ 3
- 3
node/setup.go View File

@ -152,7 +152,7 @@ func doHandshake(
func logNodeStartupInfo(state sm.State, pubKey crypto.PubKey, logger, consensusLogger log.Logger, mode string) { func logNodeStartupInfo(state sm.State, pubKey crypto.PubKey, logger, consensusLogger log.Logger, mode string) {
// Log the version info. // Log the version info.
logger.Info("Version info", logger.Info("Version info",
"software", version.TMCoreSemVer,
"tmVersion", version.TMVersion,
"block", version.BlockProtocol, "block", version.BlockProtocol,
"p2p", version.P2PProtocol, "p2p", version.P2PProtocol,
"mode", mode, "mode", mode,
@ -704,7 +704,7 @@ func makeNodeInfo(
), ),
NodeID: nodeKey.ID, NodeID: nodeKey.ID,
Network: genDoc.ChainID, Network: genDoc.ChainID,
Version: version.TMCoreSemVer,
Version: version.TMVersion,
Channels: []byte{ Channels: []byte{
bcChannel, bcChannel,
byte(cs.StateChannel), byte(cs.StateChannel),
@ -753,7 +753,7 @@ func makeSeedNodeInfo(
), ),
NodeID: nodeKey.ID, NodeID: nodeKey.ID,
Network: genDoc.ChainID, Network: genDoc.ChainID,
Version: version.TMCoreSemVer,
Version: version.TMVersion,
Channels: []byte{}, Channels: []byte{},
Moniker: config.Moniker, Moniker: config.Moniker,
Other: p2p.NodeInfoOther{ Other: p2p.NodeInfoOther{


+ 1
- 1
proxy/version.go View File

@ -9,7 +9,7 @@ import (
// the abci.RequestInfo message during handshake with the app. // the abci.RequestInfo message during handshake with the app.
// It contains only compile-time version information. // It contains only compile-time version information.
var RequestInfo = abci.RequestInfo{ var RequestInfo = abci.RequestInfo{
Version: version.TMCoreSemVer,
Version: version.TMVersion,
BlockVersion: version.BlockProtocol, BlockVersion: version.BlockProtocol,
P2PVersion: version.P2PProtocol, P2PVersion: version.P2PProtocol,
AbciVersion: version.ABCIVersion, AbciVersion: version.ABCIVersion,


+ 1
- 1
state/state.go View File

@ -32,7 +32,7 @@ var InitStateVersion = Version{
Block: version.BlockProtocol, Block: version.BlockProtocol,
App: 0, App: 0,
}, },
Software: version.TMCoreSemVer,
Software: version.TMVersion,
} }
func (v *Version) ToProto() tmstate.Version { func (v *Version) ToProto() tmstate.Version {


+ 1
- 1
statesync/syncer_test.go View File

@ -33,7 +33,7 @@ func TestSyncer_SyncAny(t *testing.T) {
Block: version.BlockProtocol, Block: version.BlockProtocol,
App: 0, App: 0,
}, },
Software: version.TMCoreSemVer,
Software: version.TMVersion,
}, },
LastBlockHeight: 1, LastBlockHeight: 1,


+ 1
- 1
tools/tm-signer-harness/main.go View File

@ -185,7 +185,7 @@ func main() {
} }
extractKey(flagTMHome, flagKeyOutputPath) extractKey(flagTMHome, flagKeyOutputPath)
case "version": case "version":
fmt.Println(version.TMCoreSemVer)
fmt.Println(version.TMVersion)
default: default:
fmt.Printf("Unrecognized command: %s\n", flag.Arg(0)) fmt.Printf("Unrecognized command: %s\n", flag.Arg(0))
os.Exit(1) os.Exit(1)


+ 5
- 3
version/version.go View File

@ -3,12 +3,14 @@ package version
import tmversion "github.com/tendermint/tendermint/proto/tendermint/version" import tmversion "github.com/tendermint/tendermint/proto/tendermint/version"
var ( var (
// TMCoreSemVer is the current version of Tendermint Core.
// It's the Semantic Version of the software.
TMCoreSemVer string
TMVersion = TMVersionDefault
) )
const ( const (
// TMVersionDefault is the used as the fallback version of Tendermint Core
// when not using git describe. It is formatted with semantic versioning.
TMVersionDefault = "0.34.10"
// ABCISemVer is the semantic version of the ABCI library // ABCISemVer is the semantic version of the ABCI library
ABCISemVer = "0.17.0" ABCISemVer = "0.17.0"


Loading…
Cancel
Save