diff --git a/cmd/serve.go b/cmd/serve.go index 89666e830e2483dc8594e11cec1e69b5b72c0e8c..7f951f3bfe0247fc8aa2890cbd0d8dd82f41e7d2 100644 --- a/cmd/serve.go +++ b/cmd/serve.go @@ -153,8 +153,8 @@ func NewCoreFromDo(do *definitions.Do) (*core.Core, error) { } logging.Msg(logger, "Modules configured", - "consensusModule", consensusConfig.Version, - "applicationManager", managerConfig.Version) + "consensusModule", consensusConfig.Name, + "applicationManager", managerConfig.Name) return core.NewCore(do.ChainId, consensusConfig, managerConfig, logger) } diff --git a/config/config.go b/config/config.go index 32f1e59b6bf3fe30a9bd450683297d616c81ff2a..24753b65ffa8d0dd9e88e4a42262198e979fc406 100644 --- a/config/config.go +++ b/config/config.go @@ -19,7 +19,6 @@ import ( "fmt" "text/template" - tendermint_version "github.com/hyperledger/burrow/consensus/tendermint/version" lconfig "github.com/hyperledger/burrow/logging/config" "github.com/hyperledger/burrow/version" "github.com/spf13/viper" @@ -42,8 +41,6 @@ type ConfigChainGeneral struct { type ConfigChainModule struct { Name string - MajorVersion uint8 - MinorVersion uint8 ModuleRelativeRoot string } @@ -102,18 +99,13 @@ func GetConfigurationFileBytes(chainId, moniker, seeds string, chainImageName st GenesisRelativePath: "genesis.json", } - tendermintVersion := tendermint_version.GetTendermintVersion() chainConsensusModule := &ConfigChainModule{ Name: "tendermint", - MajorVersion: tendermintVersion.MajorVersion, - MinorVersion: tendermintVersion.MinorVersion, ModuleRelativeRoot: "tendermint", } chainApplicationManagerModule := &ConfigChainModule{ Name: "burrowmint", - MajorVersion: burrowVersion.MajorVersion, - MinorVersion: burrowVersion.MinorVersion, ModuleRelativeRoot: "burrowmint", } tendermintModule := &ConfigTendermint{ diff --git a/config/module.go b/config/module.go index da0218c5ce47ea9b71f2b9d2b6a52883cb711a5d..8b8eb9456837096b4bc4bd91c39b06817bd3a8b9 100644 --- a/config/module.go +++ b/config/module.go @@ -23,7 +23,6 @@ import ( type ModuleConfig struct { Module string Name string - Version string WorkDir string DataDir string RootDir string diff --git a/config/templates.go b/config/templates.go index e31558abd6370f032acbcf1f9033475905964a04..80886e87fb937cc0fad86f254764b80b5916c320 100644 --- a/config/templates.go +++ b/config/templates.go @@ -89,10 +89,6 @@ const sectionChainConsensus = ` [chain.consensus] # this will define the peer-to-peer consensus network; # accepted values are ("noops", "abci",) "tendermint" name = "{{.Name}}" - # version is the major and minor semantic version; - # the version will be asserted on - major_version = {{.MajorVersion}} - minor_version = {{.MinorVersion}} # relative path to consensus' module root folder relative_root = "{{.ModuleRelativeRoot}}" @@ -111,10 +107,6 @@ const sectionChainApplicationManager = ` [chain.manager] # application manager name defines the module to use for handling # the transactions. Supported names are "burrowmint" name = "{{.Name}}" - # version is the major and minor semantic version; - # the version will be asserted on - major_version = {{.MajorVersion}} - minor_version = {{.MinorVersion}} # relative path to application manager root folder relative_root = "{{.ModuleRelativeRoot}}" diff --git a/consensus/config.go b/consensus/config.go deleted file mode 100644 index e207213dbdd22a53182f28aebf07ea11465050a6..0000000000000000000000000000000000000000 --- a/consensus/config.go +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package consensus - -import ( - tendermint_version "github.com/hyperledger/burrow/consensus/tendermint/version" -) - -//------------------------------------------------------------------------------ -// Helper functions - -func AssertValidConsensusModule(name, minorVersionString string) bool { - switch name { - case "noops": - // noops should not have any external interfaces that can change - // over iterations - return true - case "tendermint": - return minorVersionString == tendermint_version.GetTendermintVersion().GetMinorVersionString() - case "bigchaindb": - // TODO: [ben] implement BigchainDB as consensus engine - return false - } - return false -} diff --git a/consensus/tendermint/tendermint.go b/consensus/tendermint/tendermint.go index 4f793389e5ae4a1e56d3e714a85482cd3beba3c6..a35337cc3c4ac88f7c52934f0a51036723d4f625 100644 --- a/consensus/tendermint/tendermint.go +++ b/consensus/tendermint/tendermint.go @@ -19,7 +19,6 @@ import ( "path" "strings" - tendermint_version "github.com/hyperledger/burrow/consensus/tendermint/version" abci_types "github.com/tendermint/abci/types" crypto "github.com/tendermint/go-crypto" p2p "github.com/tendermint/go-p2p" @@ -58,11 +57,6 @@ var _ blockchain_types.Blockchain = (*Tendermint)(nil) func NewTendermint(moduleConfig *config.ModuleConfig, application manager_types.Application, logger logging_types.InfoTraceLogger) (*Tendermint, error) { - // re-assert proper configuration for module - if moduleConfig.Version != tendermint_version.GetTendermintVersion().GetMinorVersionString() { - return nil, fmt.Errorf("Version string %s did not match %s", - moduleConfig.Version, tendermint_version.GetTendermintVersion().GetMinorVersionString()) - } // loading the module has ensured the working and data directory // for tendermint have been created, but the config files needs // to be written in tendermint's root directory. diff --git a/consensus/tendermint/version/version.go b/consensus/tendermint/version.go similarity index 82% rename from consensus/tendermint/version/version.go rename to consensus/tendermint/version.go index 6b630784b9cb46b4a7c50348a1e4bdcde91e369d..58f690db7dbace4b8ebb5852457d7fdb26c867c8 100644 --- a/consensus/tendermint/version/version.go +++ b/consensus/tendermint/version.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package version +package tendermint import ( "strconv" @@ -25,12 +25,6 @@ import ( const ( // Client identifier to advertise over the network tendermintClientIdentifier = "tendermint" - // Major version component of the current release - tendermintVersionMajorConst uint8 = 0 - // Minor version component of the current release - tendermintVersionMinorConst uint8 = 9 - // Patch version component of the current release - tendermintVersionPatchConst uint8 = 2 ) var ( @@ -54,7 +48,7 @@ func GetTendermintVersion() *version.VersionIdentifier { func getTendermintMajorVersionFromSource() (uint8, error) { majorVersionUint, err := strconv.ParseUint(tendermint_version.Maj, 10, 8) if err != nil { - return tendermintVersionMajorConst, err + return 0, err } return uint8(majorVersionUint), nil } @@ -62,7 +56,7 @@ func getTendermintMajorVersionFromSource() (uint8, error) { func getTendermintMinorVersionFromSource() (uint8, error) { minorVersionUint, err := strconv.ParseUint(tendermint_version.Min, 10, 8) if err != nil { - return tendermintVersionMinorConst, err + return 0, err } return uint8(minorVersionUint), nil } @@ -70,7 +64,7 @@ func getTendermintMinorVersionFromSource() (uint8, error) { func getTendermintPatchVersionFromSource() (uint8, error) { patchVersionUint, err := strconv.ParseUint(tendermint_version.Fix, 10, 8) if err != nil { - return tendermintVersionPatchConst, err + return 0, err } return uint8(patchVersionUint), nil } diff --git a/consensus/tendermint/version/version_test.go b/consensus/tendermint/version_test.go similarity index 59% rename from consensus/tendermint/version/version_test.go rename to consensus/tendermint/version_test.go index f5eb9cd0b775b7aa725c42c67e3bd86f2f6b68a2..330c77425a6a281581882bda8424620873a84773 100644 --- a/consensus/tendermint/version/version_test.go +++ b/consensus/tendermint/version_test.go @@ -12,30 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -package version +package tendermint -import ( - "fmt" - "testing" - - "github.com/stretchr/testify/assert" -) - -func TestMinorVersionTendermintEqual(t *testing.T) { - // assert explicitly on major and minor version number - assert.Equal(t, tendermintVersionMajorConst, tendermintVersionMajor, - fmt.Sprintf("Major version number for Tendermint consensus is not %v as expected: %v", - tendermintVersionMajorConst, tendermintVersionMajor)) - assert.Equal(t, tendermintVersionMinorConst, tendermintVersionMinor, - fmt.Sprintf("Minor version number for Tendermint consensus is not %v as expected: %v", - tendermintVersionMinorConst, tendermintVersionMinor)) - // assert patch number can not regress - if tendermintVersionPatchConst > tendermintVersionPatch { - t.Errorf("Patch version has regressed for Tendermint consensus: expected minimally %v, got %v", - tendermintVersionPatchConst, tendermintVersionPatch) - t.Fail() - } -} +import "testing" func TestSemanticVersioningTendermint(t *testing.T) { // assert that reading the semantic version from Tendermint vendored source diff --git a/core/config.go b/core/config.go index 1b9b79dbca5b14af924f1645ea149c5194e0b1a2..8c602c716873ac39b064d5c4066dfcb6c810ee18 100644 --- a/core/config.go +++ b/core/config.go @@ -24,13 +24,10 @@ import ( "path" "github.com/hyperledger/burrow/config" - "github.com/hyperledger/burrow/consensus" "github.com/hyperledger/burrow/definitions" lconfig "github.com/hyperledger/burrow/logging/config" - "github.com/hyperledger/burrow/manager" "github.com/hyperledger/burrow/server" "github.com/hyperledger/burrow/util" - "github.com/hyperledger/burrow/version" "github.com/spf13/viper" ) @@ -54,14 +51,6 @@ func loadModuleConfigFromDo(do *definitions.Do, module string) (*config.ModuleCo func LoadModuleConfig(conf *viper.Viper, rootWorkDir, rootDataDir, genesisFile, chainId, module string) (*config.ModuleConfig, error) { moduleName := conf.GetString("chain." + module + ".name") - majorVersion := conf.GetInt("chain." + module + ".major_version") - minorVersion := conf.GetInt("chain." + module + ".minor_version") - minorVersionString := version.MakeMinorVersionString(moduleName, majorVersion, - minorVersion, 0) - if !assertValidModule(module, moduleName, minorVersionString) { - return nil, fmt.Errorf("Error reading config: %s module %s (%s) is not supported by %s", - module, moduleName, minorVersionString, version.GetVersionString()) - } // set up the directory structure for the module inside the data directory workDir := path.Join(rootDataDir, conf.GetString("chain."+module+ ".relative_root")) @@ -88,7 +77,6 @@ func LoadModuleConfig(conf *viper.Viper, rootWorkDir, rootDataDir, return &config.ModuleConfig{ Module: module, Name: moduleName, - Version: minorVersionString, WorkDir: workDir, DataDir: dataDir, RootDir: rootWorkDir, // burrow's working directory @@ -127,16 +115,3 @@ func LoadLoggingConfigFromClientDo(do *definitions.ClientDo) (*lconfig.LoggingCo loggingConfig := lconfig.DefaultClientLoggingConfig() return loggingConfig, nil } - -//------------------------------------------------------------------------------ -// Helper functions - -func assertValidModule(module, name, minorVersionString string) bool { - switch module { - case "consensus": - return consensus.AssertValidConsensusModule(name, minorVersionString) - case "manager": - return manager.AssertValidApplicationManagerModule(name, minorVersionString) - } - return false -} diff --git a/core/core.go b/core/core.go index 3dad6ff078e9142123b83b59c46779d766ca9feb..3727a823203850afe0881b950ebb41b6a10ec253 100644 --- a/core/core.go +++ b/core/core.go @@ -54,8 +54,7 @@ func NewCore(chainId string, logger = logging.WithScope(logger, "Core") // start a new application pipe that will load an application manager - pipe, err := manager.NewApplicationPipe(managerConfig, evsw, logger, - consensusConfig.Version) + pipe, err := manager.NewApplicationPipe(managerConfig, evsw, logger) if err != nil { return nil, fmt.Errorf("Failed to load application pipe: %v", err) } @@ -67,7 +66,7 @@ func NewCore(chainId string, tendermintPipe, err := pipe.GetTendermintPipe() if err != nil { logging.TraceMsg(logger, "Tendermint gateway not supported by manager", - "manager-version", managerConfig.Version) + "manager", managerConfig.Name) } return &Core{ chainId: chainId, diff --git a/manager/burrow-mint/burrow-mint_test.go b/manager/burrow-mint/burrow-mint_test.go deleted file mode 100644 index 9c1a647c2f3f4f532b55f12c49250e6e7368cfd9..0000000000000000000000000000000000000000 --- a/manager/burrow-mint/burrow-mint_test.go +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package burrowmint - -import ( - "testing" - - assert "github.com/stretchr/testify/assert" -) - -func TestCompatibleConsensus(t *testing.T) { - // TODO: [ben] expand by constructing and elementary testing for each listed - // compatible consensus engine - - for _, listedConsensus := range compatibleConsensus { - assert.Nil(t, AssertCompatibleConsensus(listedConsensus)) - } -} diff --git a/manager/burrow-mint/pipe.go b/manager/burrow-mint/pipe.go index b8315dd5ec765b20df182bb0f7ae3ddbe2cd2984..cb91fb2a2fb97791c904271713cd81a59e4f00e9 100644 --- a/manager/burrow-mint/pipe.go +++ b/manager/burrow-mint/pipe.go @@ -141,8 +141,8 @@ func startState(dataDir, backend, genesisFile, chainId string) (*state.State, // avoid Tendermints PanicSanity and return a clean error if backend != db.MemDBBackendStr && backend != db.LevelDBBackendStr { - return nil, nil, fmt.Errorf("Database backend %s is not supported by %s", - backend, GetBurrowMintVersion) + return nil, nil, fmt.Errorf("Database backend %s is not supported "+ + "by burrowmint", backend) } stateDB := db.NewDB("burrowmint", backend, dataDir) @@ -590,7 +590,7 @@ func (pipe *burrowMintPipe) BroadcastTxSync(tx txs.Tx) (*rpc_tm_types.ResultBroa return resultBroadCastTx, fmt.Errorf(resultBroadCastTx.Log) default: logging.InfoMsg(pipe.logger, "Unknown error returned from Tendermint CheckTx on BroadcastTxSync", - "application", GetBurrowMintVersion().GetVersionString(), + "application", "burrowmint", "abci_code_type", responseCheckTx.Code, "abci_log", responseCheckTx.Log, ) diff --git a/manager/config.go b/manager/config.go deleted file mode 100644 index 27d80979525f7fa7e75cf7694e3826b8982454b4..0000000000000000000000000000000000000000 --- a/manager/config.go +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package manager - -import ( - burrowmint "github.com/hyperledger/burrow/manager/burrow-mint" -) - -//------------------------------------------------------------------------------ -// Helper functions - -func AssertValidApplicationManagerModule(name, minorVersionString string) bool { - switch name { - case "burrowmint": - return minorVersionString == burrowmint.GetBurrowMintVersion().GetMinorVersionString() - case "geth": - // TODO: [ben] implement Geth 1.4 as an application manager - return false - } - return false -} diff --git a/manager/manager.go b/manager/manager.go index eac62048434dc39ff5c16946dd61130585d4587f..2724b12645714d68fd3cc0388a5367fe54453e6e 100644 --- a/manager/manager.go +++ b/manager/manager.go @@ -33,17 +33,11 @@ import ( // of an application. It is feasible this will be insufficient to support // different types of applications later down the line. func NewApplicationPipe(moduleConfig *config.ModuleConfig, - evsw events.EventSwitch, logger logging_types.InfoTraceLogger, - consensusMinorVersion string) (definitions.Pipe, - error) { + evsw events.EventSwitch, + logger logging_types.InfoTraceLogger) (definitions.Pipe, error) { switch moduleConfig.Name { case "burrowmint": - if err := burrowmint.AssertCompatibleConsensus(consensusMinorVersion); err != nil { - return nil, err - } - logging.InfoMsg(logger, "Loading BurrowMint", - "compatibleConsensus", consensusMinorVersion, - "burrowMintVersion", burrowmint.GetBurrowMintVersion().GetVersionString()) + logging.InfoMsg(logger, "Loading BurrowMint") return burrowmint.NewBurrowMintPipe(moduleConfig, evsw, logger) } return nil, fmt.Errorf("Failed to return Pipe for %s", moduleConfig.Name)