Skip to content

Commit

Permalink
Renames the semantic versioning variable to CMT (cometbft#1621)
Browse files Browse the repository at this point in the history
* Renames the semantic versioning variable to CMT...

* Fixing common.mk to include hash in the version, as in 0.39.0-dev+c86d72d29

* Adding changelog
  • Loading branch information
lasarojc authored Nov 22, 2023
1 parent 4673933 commit 6302491
Show file tree
Hide file tree
Showing 22 changed files with 34 additions and 32 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- `[comet]` Version variables, in `version/version.go`, have been renamed to reflect the CometBFT rebranding.
([cometbft/cometbft\#1621](https://github.com/cometbft/cometbft/pull/1621))
2 changes: 1 addition & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ builds:
- id: "cometbft"
main: ./cmd/cometbft/main.go
ldflags:
- -s -w -X github.com/cometbft/cometbft/version.TMCoreSemVer={{ .Version }}
- -s -w -X github.com/cometbft/cometbft/version.CMTSemVer={{ .Version }}
env:
- CGO_ENABLED=0
goos:
Expand Down
2 changes: 1 addition & 1 deletion DOCKER/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -e

# Get the tag from the version, or try to figure it out.
if [ -z "$TAG" ]; then
TAG=$(awk -F\" '/TMCoreSemVer =/ { print $2; exit }' < ../version/version.go)
TAG=$(awk -F\" '/CMTSemVer =/ { print $2; exit }' < ../version/version.go)
fi
if [ -z "$TAG" ]; then
echo "Please specify a tag."
Expand Down
2 changes: 1 addition & 1 deletion DOCKER/push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -e

# Get the tag from the version, or try to figure it out.
if [ -z "$TAG" ]; then
TAG=$(awk -F\" '/TMCoreSemVer =/ { print $2; exit }' < ../version/version.go)
TAG=$(awk -F\" '/CMTSemVer =/ { print $2; exit }' < ../version/version.go)
fi
if [ -z "$TAG" ]; then
echo "Please specify a tag."
Expand Down
6 changes: 3 additions & 3 deletions RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ backport branch (see above). Otherwise:
* Ensure that `UPGRADING.md` is up-to-date and includes notes on any breaking
changes or other upgrading flows.
4. Prepare the versioning:
* Bump TMVersionDefault version in `version.go`
* Bump CometBFT version in `version.go`
* Bump P2P and block protocol versions in `version.go`, if necessary.
Check the changelog for breaking changes in these components.
* Bump ABCI protocol version in `version.go`, if necessary
Expand Down Expand Up @@ -201,7 +201,7 @@ Before performing these steps, be sure the
* Build the changelog using unclog, and commit the built changelog.
* Ensure that `UPGRADING.md` is up-to-date and includes notes on any breaking changes
or other upgrading flows.
* Bump TMVersionDefault version in `version.go`
* Bump CometBFT version in `version.go`
* Bump P2P and block protocol versions in `version.go`, if necessary
* Bump ABCI protocol version in `version.go`, if necessary
4. Open a PR with these changes against the backport branch.
Expand Down Expand Up @@ -229,7 +229,7 @@ To create a patch release:
ensuring that you write up a good summary of the major highlights of the
release that users would be interested in.
* Build the changelog using unclog, and commit the built changelog.
* Bump the TMDefaultVersion in `version.go`
* Bump the CometBFT in `version.go`
* Bump the ABCI version number, if necessary. (Note that ABCI follows semver,
and that ABCI versions are the only versions which can change during patch
releases, and only field additions are valid patch changes.)
Expand Down
6 changes: 3 additions & 3 deletions cmd/cometbft/commands/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ var VersionCmd = &cobra.Command{
Use: "version",
Short: "Show version info",
Run: func(cmd *cobra.Command, args []string) {
cmtVersion := version.TMCoreSemVer
if version.TMGitCommitHash != "" {
cmtVersion += "+" + version.TMGitCommitHash
cmtVersion := version.CMTSemVer
if version.CMTGitCommitHash != "" {
cmtVersion += "+" + version.CMTGitCommitHash
}

if verbose {
Expand Down
2 changes: 1 addition & 1 deletion common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
BUILD_TAGS ?= cometbft

COMMIT_HASH := $(shell git rev-parse --short HEAD)
LD_FLAGS = -X github.com/cometbft/cometbft/version.TMGitCommitHash=$(COMMIT_HASH)
LD_FLAGS = -X github.com/cometbft/cometbft/version.CMTGitCommitHash=$(COMMIT_HASH)
BUILD_FLAGS = -mod=readonly -ldflags "$(LD_FLAGS)"
# allow users to pass additional flags via the conventional LDFLAGS variable
LD_FLAGS += $(LDFLAGS)
Expand Down
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ type BaseConfig struct { //nolint: maligned
// DefaultBaseConfig returns a default base configuration for a CometBFT node
func DefaultBaseConfig() BaseConfig {
return BaseConfig{
Version: version.TMCoreSemVer,
Version: version.CMTSemVer,
Genesis: defaultGenesisJSONPath,
PrivValidatorKey: defaultPrivValKeyPath,
PrivValidatorState: defaultPrivValStatePath,
Expand Down
2 changes: 1 addition & 1 deletion internal/state/rollback.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func Rollback(bs BlockStore, ss Store, removeBlock bool) (int64, []byte, error)
Block: version.BlockProtocol,
App: previousParams.Version.App,
},
Software: version.TMCoreSemVer,
Software: version.CMTSemVer,
},
// immutable fields
ChainID: invalidState.ChainID,
Expand Down
6 changes: 3 additions & 3 deletions internal/state/rollback_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func TestRollbackHard(t *testing.T) {
currState := state.State{
Version: cmtstate.Version{
Consensus: block.Header.Version,
Software: version.TMCoreSemVer,
Software: version.CMTSemVer,
},
LastBlockHeight: block.Height,
LastBlockTime: block.Time,
Expand Down Expand Up @@ -181,7 +181,7 @@ func TestRollbackHard(t *testing.T) {
nextState := state.State{
Version: cmtstate.Version{
Consensus: block.Header.Version,
Software: version.TMCoreSemVer,
Software: version.CMTSemVer,
},
LastBlockHeight: nextBlock.Height,
LastBlockTime: nextBlock.Time,
Expand Down Expand Up @@ -251,7 +251,7 @@ func setupStateStore(t *testing.T, height int64) state.Store {
Block: version.BlockProtocol,
App: 10,
},
Software: version.TMCoreSemVer,
Software: version.CMTSemVer,
},
ChainID: "test-chain",
InitialHeight: 10,
Expand Down
2 changes: 1 addition & 1 deletion internal/state/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ var InitStateVersion = cmtstate.Version{
Block: version.BlockProtocol,
App: 0,
},
Software: version.TMCoreSemVer,
Software: version.CMTSemVer,
}

//-----------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion internal/statesync/stateprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func (s *lightClientStateProvider) State(ctx context.Context, height uint64) (sm

state.Version = cmtstate.Version{
Consensus: currentLightBlock.Version,
Software: version.TMCoreSemVer,
Software: version.CMTSemVer,
}
state.LastBlockHeight = lastLightBlock.Height
state.LastBlockTime = lastLightBlock.Time
Expand Down
2 changes: 1 addition & 1 deletion internal/statesync/syncer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func TestSyncer_SyncAny(t *testing.T) {
Block: version.BlockProtocol,
App: testAppVersion,
},
Software: version.TMCoreSemVer,
Software: version.CMTSemVer,
},

LastBlockHeight: 1,
Expand Down
2 changes: 1 addition & 1 deletion node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -978,7 +978,7 @@ func makeNodeInfo(
),
DefaultNodeID: nodeKey.ID(),
Network: genDoc.ChainID,
Version: version.TMCoreSemVer,
Version: version.CMTSemVer,
Channels: []byte{
bc.BlocksyncChannel,
cs.StateChannel, cs.DataChannel, cs.VoteChannel, cs.VoteSetBitsChannel,
Expand Down
4 changes: 2 additions & 2 deletions node/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,11 @@ func doHandshake(
func logNodeStartupInfo(state sm.State, pubKey crypto.PubKey, logger, consensusLogger log.Logger) {
// Log the version info.
logger.Info("Version info",
"tendermint_version", version.TMCoreSemVer,
"tendermint_version", version.CMTSemVer,
"abci", version.ABCISemVer,
"block", version.BlockProtocol,
"p2p", version.P2PProtocol,
"commit_hash", version.TMGitCommitHash,
"commit_hash", version.CMTGitCommitHash,
)

// If the state and software differ in block version, at least log it.
Expand Down
2 changes: 1 addition & 1 deletion proxy/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
// the abci.RequestInfo message during handshake with the app.
// It contains only compile-time version information.
var RequestInfo = &abci.RequestInfo{
Version: version.TMCoreSemVer,
Version: version.CMTSemVer,
BlockVersion: version.BlockProtocol,
P2PVersion: version.P2PProtocol,
AbciVersion: version.ABCIVersion,
Expand Down
2 changes: 1 addition & 1 deletion rpc/grpc/server/services/versionservice/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func New() v1.VersionServiceServer {
// GetVersion implements v1.VersionServiceServer
func (s *versionServiceServer) GetVersion(context.Context, *v1.GetVersionRequest) (*v1.GetVersionResponse, error) {
return &v1.GetVersionResponse{
Node: version.TMCoreSemVer,
Node: version.CMTSemVer,
Abci: version.ABCIVersion,
P2P: version.P2PProtocol,
Block: version.BlockProtocol,
Expand Down
4 changes: 2 additions & 2 deletions scripts/dist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -e

# Get the version from the environment, or try to figure it out.
if [ -z $VERSION ]; then
VERSION=$(awk -F\" 'TMCoreSemVer =/ { print $2; exit }' < version/version.go)
VERSION=$(awk -F\" 'CMTSemVer =/ { print $2; exit }' < version/version.go)
fi
if [ -z "$VERSION" ]; then
echo "Please specify a version."
Expand Down Expand Up @@ -41,7 +41,7 @@ for arch in "${arch_list[@]}"; do
for os in "${os_list[@]}"; do
if [[ "$XC_EXCLUDE" != *" $os/$arch "* ]]; then
echo "--> $os/$arch"
GOOS=${os} GOARCH=${arch} go build -ldflags "-s -w -X ${GIT_IMPORT}.TMCoreSemVer=${VERSION}" -tags="${BUILD_TAGS}" -o "build/pkg/${os}_${arch}/cometbft" ./cmd/cometbft
GOOS=${os} GOARCH=${arch} go build -ldflags "-s -w -X ${GIT_IMPORT}.CMTSemVer=${VERSION}" -tags="${BUILD_TAGS}" -o "build/pkg/${os}_${arch}/cometbft" ./cmd/cometbft
fi
done
done
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ generator. For example:
# the CometBFT version in the current local code (as specified in
# ../../version/version.go).
#
# In the example below, if the local version.TMCoreSemVer value is "v0.34.24",
# In the example below, if the local version value is "v0.34.24",
# for example, and the latest official release is v0.34.23, then 1/3rd of the
# network will run v0.34.23 and the remaining 2/3rds will run the E2E node built
# from the local code.
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/generator/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ func gitRepoLatestReleaseVersion(gitRepoDir string) (string, error) {
if err != nil {
return "", err
}
return findLatestReleaseTag(version.TMCoreSemVer, tags)
return findLatestReleaseTag(version.CMTSemVer, tags)
}

func findLatestReleaseTag(baseVer string, tags []string) (string, error) {
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/tests/grpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func TestGRPC_Version(t *testing.T) {
res, err := client.GetVersion(ctx)
require.NoError(t, err)

require.Equal(t, version.TMCoreSemVer, res.Node)
require.Equal(t, version.CMTSemVer, res.Node)
require.Equal(t, version.ABCIVersion, res.ABCI)
require.Equal(t, version.P2PProtocol, res.P2P)
require.Equal(t, version.BlockProtocol, res.Block)
Expand Down
8 changes: 4 additions & 4 deletions version/version.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package version

const (
// TMVersionDefault is the used as the fallback version of CometBFT
// CMTSemVer is the used as the fallback version of CometBFT
// when not using git describe. It is formatted with semantic versioning.
TMCoreSemVer = "0.39.0-dev"
CMTSemVer = "0.39.0-dev"
// ABCISemVer is the semantic version of the ABCI protocol
ABCISemVer = "2.0.0"
ABCIVersion = ABCISemVer
Expand All @@ -16,6 +16,6 @@ const (
BlockProtocol uint64 = 11
)

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

0 comments on commit 6302491

Please sign in to comment.