Skip to content

Commit

Permalink
config v0.34: use a different source of versioning (#204)
Browse files Browse the repository at this point in the history
* config: use a different source of versioning (#9486)

* Changed version generation

* Fixed comment describing the versioning

Co-authored-by: Callum Waters <[email protected]>
  • Loading branch information
jmalicevic and cmwaters authored Jan 26, 2023
1 parent 3351d19 commit ce0db1f
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 16 deletions.
9 changes: 2 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,9 @@ OUTPUT?=build/cometbft

BUILD_TAGS?=cometbft

# 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 --tags)
endif
COMMIT_HASH := $(shell git rev-parse --short HEAD)

LD_FLAGS = -X github.com/cometbft/cometbft/version.TMCoreSemVer=$(VERSION)
LD_FLAGS = -X github.com/cometbft/cometbft/version.TMGitCommitHash=$(COMMIT_HASH)
BUILD_FLAGS = -mod=readonly -ldflags "$(LD_FLAGS)"
HTTPS_GIT := https://github.com/cometbft/cometbft.git
CGO_ENABLED ?= 0
Expand Down
2 changes: 1 addition & 1 deletion abci/example/kvstore/kvstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func (app *Application) SetGenBlockEvents() {
func (app *Application) Info(req types.RequestInfo) (resInfo types.ResponseInfo) {
return types.ResponseInfo{
Data: fmt.Sprintf("{\"size\":%v}", app.state.Size),
Version: version.ABCIVersion,
Version: version.ABCISemVer,
AppVersion: ProtocolVersion,
LastBlockHeight: app.state.Height,
LastBlockAppHash: app.state.AppHash,
Expand Down
2 changes: 1 addition & 1 deletion abci/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ import (

// TODO: eliminate this after some version refactor

const Version = version.ABCIVersion
const Version = version.ABCISemVer
11 changes: 8 additions & 3 deletions cmd/tendermint/commands/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,26 @@ var VersionCmd = &cobra.Command{
Use: "version",
Short: "Show version info",
Run: func(cmd *cobra.Command, args []string) {
tmVersion := version.TMCoreSemVer
if version.TMGitCommitHash != "" {
tmVersion += "+" + version.TMGitCommitHash
}

if verbose {
values, _ := json.MarshalIndent(struct {
Tendermint string `json:"tendermint"`
ABCI string `json:"abci"`
BlockProtocol uint64 `json:"block_protocol"`
P2PProtocol uint64 `json:"p2p_protocol"`
}{
Tendermint: version.TMCoreSemVer,
ABCI: version.ABCIVersion,
Tendermint: tmVersion,
ABCI: version.ABCISemVer,
BlockProtocol: version.BlockProtocol,
P2PProtocol: version.P2PProtocol,
}, "", " ")
fmt.Println(string(values))
} else {
fmt.Println(version.TMCoreSemVer)
fmt.Println(tmVersion)
}
},
}
Expand Down
2 changes: 2 additions & 0 deletions node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,10 @@ func logNodeStartupInfo(state sm.State, pubKey crypto.PubKey, logger, consensusL
// Log the version info.
logger.Info("Version info",
"tendermint_version", version.TMCoreSemVer,
"abci", version.ABCISemVer,
"block", version.BlockProtocol,
"p2p", version.P2PProtocol,
"commit_hash", version.TMGitCommitHash,
)

// If the state and software differ in block version, at least log it.
Expand Down
12 changes: 8 additions & 4 deletions version/version.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package version

var TMCoreSemVer = TMVersionDefault

const (
// TMVersionDefault is the used as the fallback version of Tendermint Core
// TMCoreSemVer is the used as the fallback version of Tendermint Core
// when not using git describe. It is formatted with semantic versioning.
TMVersionDefault = "0.34.24"
TMCoreSemVer = "0.34.24"
// ABCISemVer is the semantic version of the ABCI library
ABCISemVer = "0.17.0"

Expand All @@ -21,3 +19,9 @@ var (
// This includes validity of blocks and state updates.
BlockProtocol uint64 = 11
)

var (
// TMGitCommitHash uses git rev-parse HEAD to find commit hash which is helpful
// for the engineering team when working with the tendermint binary. See Makefile
TMGitCommitHash = ""
)

0 comments on commit ce0db1f

Please sign in to comment.