mirror of
https://github.com/fluencelabs/tendermint
synced 2025-04-25 06:42:16 +00:00
more versioning
This commit is contained in:
parent
78768082a1
commit
b54522c60f
@ -48,7 +48,7 @@ Commands:
|
|||||||
case "unsafe_reset_priv_validator":
|
case "unsafe_reset_priv_validator":
|
||||||
reset_priv_validator()
|
reset_priv_validator()
|
||||||
case "version":
|
case "version":
|
||||||
fmt.Println(config.GetString("version"))
|
fmt.Println(node.Version)
|
||||||
default:
|
default:
|
||||||
fmt.Printf("Unknown command %v\n", args[0])
|
fmt.Printf("Unknown command %v\n", args[0])
|
||||||
}
|
}
|
||||||
|
@ -54,14 +54,7 @@ func GetConfig(rootDir string) cfg.Config {
|
|||||||
if mapConfig.IsSet("chain_id") {
|
if mapConfig.IsSet("chain_id") {
|
||||||
Exit("Cannot set 'chain_id' via config.toml")
|
Exit("Cannot set 'chain_id' via config.toml")
|
||||||
}
|
}
|
||||||
if mapConfig.IsSet("version") {
|
|
||||||
Exit("Cannot set 'version' via config.toml")
|
|
||||||
}
|
|
||||||
mapConfig.SetDefault("chain_id", "tendermint_testnet_10")
|
mapConfig.SetDefault("chain_id", "tendermint_testnet_10")
|
||||||
// Major: alpha
|
|
||||||
// Minor: encrypted p2p!
|
|
||||||
// Revision: ripemd for NewContractAddress
|
|
||||||
mapConfig.SetDefault("version", "0.5.1")
|
|
||||||
mapConfig.SetDefault("genesis_file", rootDir+"/genesis.json")
|
mapConfig.SetDefault("genesis_file", rootDir+"/genesis.json")
|
||||||
mapConfig.SetDefault("moniker", "anonymous")
|
mapConfig.SetDefault("moniker", "anonymous")
|
||||||
mapConfig.SetDefault("node_laddr", "0.0.0.0:46656")
|
mapConfig.SetDefault("node_laddr", "0.0.0.0:46656")
|
||||||
|
@ -59,11 +59,7 @@ func GetConfig(rootDir string) cfg.Config {
|
|||||||
if mapConfig.IsSet("chain_id") {
|
if mapConfig.IsSet("chain_id") {
|
||||||
Exit("Cannot set 'chain_id' via config.toml")
|
Exit("Cannot set 'chain_id' via config.toml")
|
||||||
}
|
}
|
||||||
if mapConfig.IsSet("version") {
|
|
||||||
Exit("Cannot set 'version' via config.toml")
|
|
||||||
}
|
|
||||||
mapConfig.SetDefault("chain_id", "tendermint_test")
|
mapConfig.SetDefault("chain_id", "tendermint_test")
|
||||||
mapConfig.SetDefault("version", "0.5.0")
|
|
||||||
mapConfig.SetDefault("genesis_file", rootDir+"/genesis.json")
|
mapConfig.SetDefault("genesis_file", rootDir+"/genesis.json")
|
||||||
mapConfig.SetDefault("moniker", "anonymous")
|
mapConfig.SetDefault("moniker", "anonymous")
|
||||||
mapConfig.SetDefault("node_laddr", "0.0.0.0:36656")
|
mapConfig.SetDefault("node_laddr", "0.0.0.0:36656")
|
||||||
|
10
node/node.go
10
node/node.go
@ -18,6 +18,7 @@ import (
|
|||||||
"github.com/tendermint/tendermint/events"
|
"github.com/tendermint/tendermint/events"
|
||||||
mempl "github.com/tendermint/tendermint/mempool"
|
mempl "github.com/tendermint/tendermint/mempool"
|
||||||
"github.com/tendermint/tendermint/p2p"
|
"github.com/tendermint/tendermint/p2p"
|
||||||
|
"github.com/tendermint/tendermint/rpc"
|
||||||
"github.com/tendermint/tendermint/rpc/core"
|
"github.com/tendermint/tendermint/rpc/core"
|
||||||
"github.com/tendermint/tendermint/rpc/server"
|
"github.com/tendermint/tendermint/rpc/server"
|
||||||
sm "github.com/tendermint/tendermint/state"
|
sm "github.com/tendermint/tendermint/state"
|
||||||
@ -246,12 +247,17 @@ func makeNodeInfo(sw *p2p.Switch, privKey acm.PrivKeyEd25519) *types.NodeInfo {
|
|||||||
PubKey: privKey.PubKey().(acm.PubKeyEd25519),
|
PubKey: privKey.PubKey().(acm.PubKeyEd25519),
|
||||||
Moniker: config.GetString("moniker"),
|
Moniker: config.GetString("moniker"),
|
||||||
ChainID: config.GetString("chain_id"),
|
ChainID: config.GetString("chain_id"),
|
||||||
Version: config.GetString("version"),
|
Version: types.Versions{
|
||||||
|
Tendermint: Version,
|
||||||
|
P2P: p2p.Version,
|
||||||
|
RPC: rpc.Version,
|
||||||
|
Wire: wire.Version,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// include git hash in the nodeInfo if available
|
// include git hash in the nodeInfo if available
|
||||||
if rev, err := ReadFile(config.GetString("revisions_file")); err == nil {
|
if rev, err := ReadFile(config.GetString("revisions_file")); err == nil {
|
||||||
nodeInfo.Revision = string(rev)
|
nodeInfo.Version.Revision = string(rev)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !sw.IsListening() {
|
if !sw.IsListening() {
|
||||||
|
6
node/version.go
Normal file
6
node/version.go
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
package node
|
||||||
|
|
||||||
|
// Major: alpha
|
||||||
|
// Minor: encrypted p2p!
|
||||||
|
// Patch: New block pool logic
|
||||||
|
const Version = "0.5.2"
|
@ -81,7 +81,7 @@ func makeSwitchPair(t testing.TB, initSwitch func(*Switch) *Switch) (*Switch, *S
|
|||||||
PubKey: s1PrivKey.PubKey().(acm.PubKeyEd25519),
|
PubKey: s1PrivKey.PubKey().(acm.PubKeyEd25519),
|
||||||
Moniker: "switch1",
|
Moniker: "switch1",
|
||||||
ChainID: "testing",
|
ChainID: "testing",
|
||||||
Version: "123.123.123",
|
Version: types.Versions{Tendermint: "123.123.123"},
|
||||||
})
|
})
|
||||||
s1.SetNodePrivKey(s1PrivKey)
|
s1.SetNodePrivKey(s1PrivKey)
|
||||||
s2 := initSwitch(NewSwitch())
|
s2 := initSwitch(NewSwitch())
|
||||||
@ -89,7 +89,7 @@ func makeSwitchPair(t testing.TB, initSwitch func(*Switch) *Switch) (*Switch, *S
|
|||||||
PubKey: s2PrivKey.PubKey().(acm.PubKeyEd25519),
|
PubKey: s2PrivKey.PubKey().(acm.PubKeyEd25519),
|
||||||
Moniker: "switch2",
|
Moniker: "switch2",
|
||||||
ChainID: "testing",
|
ChainID: "testing",
|
||||||
Version: "123.123.123",
|
Version: types.Versions{Tendermint: "123.123.123"},
|
||||||
})
|
})
|
||||||
s2.SetNodePrivKey(s2PrivKey)
|
s2.SetNodePrivKey(s2PrivKey)
|
||||||
|
|
||||||
|
3
p2p/version.go
Normal file
3
p2p/version.go
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
package p2p
|
||||||
|
|
||||||
|
const Version = "0.3.0"
|
3
rpc/version.go
Normal file
3
rpc/version.go
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
package rpc
|
||||||
|
|
||||||
|
const Version = "0.4.0"
|
@ -7,19 +7,28 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type NodeInfo struct {
|
type NodeInfo struct {
|
||||||
PubKey acm.PubKeyEd25519 `json:"pub_key"`
|
PubKey acm.PubKeyEd25519 `json:"pub_key"`
|
||||||
Moniker string `json:"moniker"`
|
Moniker string `json:"moniker"`
|
||||||
ChainID string `json:"chain_id"`
|
ChainID string `json:"chain_id"`
|
||||||
Version string `json:"version"`
|
Host string `json:"host"`
|
||||||
Revision string `json:"revision"`
|
P2PPort uint16 `json:"p2p_port"`
|
||||||
Host string `json:"host"`
|
RPCPort uint16 `json:"rpc_port"`
|
||||||
P2PPort uint16 `json:"p2p_port"`
|
|
||||||
RPCPort uint16 `json:"rpc_port"`
|
Version Versions `json:"versions"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Versions struct {
|
||||||
|
Revision string `json:"revision"`
|
||||||
|
Tendermint string `json:"tendermint"`
|
||||||
|
P2P string `json:"p2p"`
|
||||||
|
RPC string `json:"rpc"`
|
||||||
|
Wire string `json:"wire"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// CONTRACT: two nodes with the same Tendermint major and minor version and with the same ChainID are compatible
|
||||||
func (ni *NodeInfo) CompatibleWith(no *NodeInfo) error {
|
func (ni *NodeInfo) CompatibleWith(no *NodeInfo) error {
|
||||||
iM, im, _, ie := splitVersion(ni.Version)
|
iM, im, _, ie := splitVersion(ni.Version.Tendermint)
|
||||||
oM, om, _, oe := splitVersion(no.Version)
|
oM, om, _, oe := splitVersion(no.Version.Tendermint)
|
||||||
|
|
||||||
// if our own version number is not formatted right, we messed up
|
// if our own version number is not formatted right, we messed up
|
||||||
if ie != nil {
|
if ie != nil {
|
||||||
|
3
wire/version.go
Normal file
3
wire/version.go
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
package wire
|
||||||
|
|
||||||
|
const Version = "0.5.0"
|
Loading…
x
Reference in New Issue
Block a user