From c376b44f1cefef04274a909df5c40c78d0a9b9a8 Mon Sep 17 00:00:00 2001 From: Marko Date: Mon, 31 May 2021 21:15:12 +0000 Subject: [PATCH] Backport: #6494 (#6506) * version: revert version through ldflag only (#6494) 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 * revert variable rename * Update CHANGELOG_PENDING.md --- CHANGELOG_PENDING.md | 4 +++- CONTRIBUTING.md | 1 + Makefile | 9 ++++++++- node/node.go | 2 +- statesync/syncer_test.go | 1 - version/version.go | 7 ++++--- 6 files changed, 17 insertions(+), 7 deletions(-) diff --git a/CHANGELOG_PENDING.md b/CHANGELOG_PENDING.md index f94afa373..1206ff5cf 100644 --- a/CHANGELOG_PENDING.md +++ b/CHANGELOG_PENDING.md @@ -12,6 +12,8 @@ Friendly reminder, we have a [bug bounty program](https://hackerone.com/tendermi - Apps + - [Version] \#6494 `TMCoreSemVer` is not required to be set as a ldflag any longer. + - P2P Protocol - Go API @@ -26,4 +28,4 @@ Friendly reminder, we have a [bug bounty program](https://hackerone.com/tendermi ### BUG FIXES -- [evidence] \#6375 Fix bug with inconsistent LightClientAttackEvidence hashing (cmwaters) \ No newline at end of file +- [evidence] \#6375 Fix bug with inconsistent LightClientAttackEvidence hashing (cmwaters) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7277f36ff..715019e90 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -240,6 +240,7 @@ Each PR should have one commit once it lands on `master`; this can be accomplish 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 ` - Reset the `CHANGELOG_PENDING.md` + - Bump TMVersionDefault version in `version.go` - Bump P2P and block protocol versions 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` diff --git a/Makefile b/Makefile index e0b1f3b70..50354ebd5 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,14 @@ PACKAGES=$(shell go list ./...) OUTPUT?=build/tendermint BUILD_TAGS?=tendermint -VERSION := $(shell git describe --always) + +# If building a release, please checkout the version tag to get the correct version setting +ifneq ($(shell git symbolic-ref -q --short HEAD),) +VERSION := unreleased-$(shell git symbolic-ref -q --short HEAD)-$(shell git rev-parse HEAD) +else +VERSION := $(shell git describe) +endif + LD_FLAGS = -X github.com/tendermint/tendermint/version.TMCoreSemVer=$(VERSION) BUILD_FLAGS = -mod=readonly -ldflags "$(LD_FLAGS)" HTTPS_GIT := https://github.com/tendermint/tendermint.git diff --git a/node/node.go b/node/node.go index 738d3a589..d395a7d66 100644 --- a/node/node.go +++ b/node/node.go @@ -314,7 +314,7 @@ func doHandshake( func logNodeStartupInfo(state sm.State, pubKey crypto.PubKey, logger, consensusLogger log.Logger) { // Log the version info. logger.Info("Version info", - "software", version.TMCoreSemVer, + "tendermint_version", version.TMCoreSemVer, "block", version.BlockProtocol, "p2p", version.P2PProtocol, ) diff --git a/statesync/syncer_test.go b/statesync/syncer_test.go index 89c32f48a..a534f0452 100644 --- a/statesync/syncer_test.go +++ b/statesync/syncer_test.go @@ -50,7 +50,6 @@ func TestSyncer_SyncAny(t *testing.T) { Block: version.BlockProtocol, App: 0, }, - Software: version.TMCoreSemVer, }, diff --git a/version/version.go b/version/version.go index 5082d73c1..9a33ef215 100644 --- a/version/version.go +++ b/version/version.go @@ -1,12 +1,13 @@ package version var ( - // TMCoreSemVer is the current version of Tendermint Core. - // It's the Semantic Version of the software. - TMCoreSemVer string + TMCoreSemVer = TMVersionDefault ) 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 = "0.17.0"