Browse Source

Merge remote-tracking branch 'origin/config' into develop

pull/155/head
Jae Kwon 9 years ago
parent
commit
fa956596dc
6 changed files with 41 additions and 10 deletions
  1. +2
    -1
      Makefile
  2. +7
    -1
      config/tendermint/config.go
  3. +4
    -1
      config/tendermint_test/config.go
  4. +13
    -1
      node/node.go
  5. +4
    -0
      p2p/netaddress.go
  6. +11
    -6
      vm/vm.go

+ 2
- 1
Makefile View File

@ -50,4 +50,5 @@ gen_client:
go generate rpc/core_client/*.go
revision:
-echo `git rev-parse --verify HEAD` >> $(TMROOT)/revisions
-echo `git rev-parse --verify HEAD` > $(TMROOT)/revision
-echo `git rev-parse --verify HEAD` >> $(TMROOT)/revision_history

+ 7
- 1
config/tendermint/config.go View File

@ -54,6 +54,9 @@ func GetConfig(rootDir string) cfg.Config {
if mapConfig.IsSet("chain_id") {
Exit("Cannot set 'chain_id' via config.toml")
}
if mapConfig.IsSet("revision_file") {
Exit("Cannot set 'revision_file' via config.toml. It must match what's in the Makefile")
}
mapConfig.SetDefault("chain_id", "tendermint_testnet_11.b")
mapConfig.SetDefault("genesis_file", rootDir+"/genesis.json")
mapConfig.SetDefault("moniker", "anonymous")
@ -65,9 +68,12 @@ func GetConfig(rootDir string) cfg.Config {
mapConfig.SetDefault("priv_validator_file", rootDir+"/priv_validator.json")
mapConfig.SetDefault("db_backend", "leveldb")
mapConfig.SetDefault("db_dir", rootDir+"/data")
mapConfig.SetDefault("vm_log", true)
mapConfig.SetDefault("log_level", "info")
mapConfig.SetDefault("rpc_laddr", "0.0.0.0:46657")
mapConfig.SetDefault("revisions_file", rootDir+"/revisions")
mapConfig.SetDefault("prof_laddr", "")
mapConfig.SetDefault("revision_file", rootDir+"/revision")
mapConfig.SetDefault("local_routing", false)
return mapConfig
}


+ 4
- 1
config/tendermint_test/config.go View File

@ -70,8 +70,11 @@ func GetConfig(rootDir string) cfg.Config {
mapConfig.SetDefault("db_backend", "memdb")
mapConfig.SetDefault("db_dir", rootDir+"/data")
mapConfig.SetDefault("log_level", "debug")
mapConfig.SetDefault("vm_log", true)
mapConfig.SetDefault("rpc_laddr", "0.0.0.0:36657")
mapConfig.SetDefault("revisions_file", rootDir+"/revisions")
mapConfig.SetDefault("prof_laddr", "")
mapConfig.SetDefault("revision_file", rootDir+"/revision")
mapConfig.SetDefault("local_routing", false)
return mapConfig
}


+ 13
- 1
node/node.go View File

@ -24,6 +24,7 @@ import (
sm "github.com/tendermint/tendermint/state"
stypes "github.com/tendermint/tendermint/state/types"
"github.com/tendermint/tendermint/types"
"github.com/tendermint/tendermint/vm"
"github.com/tendermint/tendermint/wire"
)
@ -127,6 +128,17 @@ func NewNode() *Node {
// they should all satisfy events.Eventable
SetFireable(eventSwitch, pexReactor, bcReactor, mempoolReactor, consensusReactor)
// run the profile server
profileHost := config.GetString("prof_laddr")
if profileHost != "" {
go func() {
log.Warn("Profile server", "error", http.ListenAndServe(profileHost, nil))
}()
}
// set vm log level
vm.SetDebug(config.GetBool("vm_log"))
return &Node{
sw: sw,
evsw: eventSwitch,
@ -256,7 +268,7 @@ func makeNodeInfo(sw *p2p.Switch, privKey acm.PrivKeyEd25519) *types.NodeInfo {
}
// include git hash in the nodeInfo if available
if rev, err := ReadFile(config.GetString("revisions_file")); err == nil {
if rev, err := ReadFile(config.GetString("revision_file")); err == nil {
nodeInfo.Version.Revision = string(rev)
}


+ 4
- 0
p2p/netaddress.go View File

@ -110,6 +110,10 @@ func (na *NetAddress) DialTimeout(timeout time.Duration) (net.Conn, error) {
}
func (na *NetAddress) Routable() bool {
if config.GetBool("local_routing") {
return na.Valid()
}
// TODO(oga) bitcoind doesn't include RFC3849 here, but should we?
return na.Valid() && !(na.RFC1918() || na.RFC3927() || na.RFC4862() ||
na.RFC4193() || na.RFC4843() || na.Local())


+ 11
- 6
vm/vm.go View File

@ -36,15 +36,20 @@ func (err ErrPermission) Error() string {
return fmt.Sprintf("Contract does not have permission to %s", err.typ)
}
type Debug bool
const (
dataStackCapacity = 1024
callStackCapacity = 100 // TODO ensure usage.
memoryCapacity = 1024 * 1024 // 1 MB
dbg Debug = true
dataStackCapacity = 1024
callStackCapacity = 100 // TODO ensure usage.
memoryCapacity = 1024 * 1024 // 1 MB
)
type Debug bool
var dbg Debug
func SetDebug(d bool) {
dbg = Debug(d)
}
func (d Debug) Printf(s string, a ...interface{}) {
if d {
fmt.Printf(s, a...)


Loading…
Cancel
Save