From f21eb88ad1cf54b342187e8d3b55374a695cd524 Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 20 Mar 2014 17:27:48 +0100 Subject: [PATCH] Some minor updates --- ethutil/config.go | 6 +++++- ethutil/parsing.go | 10 +++++++++- ethutil/trie_test.go | 1 + 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/ethutil/config.go b/ethutil/config.go index 436c12b92..54b066fb9 100644 --- a/ethutil/config.go +++ b/ethutil/config.go @@ -50,12 +50,16 @@ func ReadConfig(base string) *config { Config = &config{ExecPath: path, Debug: true, Ver: "0.3.1"} Config.Log = NewLogger(LogFile|LogStd, LogLevelDebug) - Config.ClientString = fmt.Sprintf("/Ethereum(G) v%s/%s", Config.Ver, runtime.GOOS) + Config.SetClientString("/Ethereum(G)") } return Config } +func (c *config) SetClientString(str string) { + Config.ClientString = fmt.Sprintf("%s nv%s/%s", str, c.Ver, runtime.GOOS) +} + type LoggerType byte const ( diff --git a/ethutil/parsing.go b/ethutil/parsing.go index 553bb9717..459cdc284 100644 --- a/ethutil/parsing.go +++ b/ethutil/parsing.go @@ -58,6 +58,10 @@ var OpCodes = map[string]byte{ "BALANCE": 0x3c, "MKTX": 0x3d, "SUICIDE": 0x3f, + + // TODO FIX OPCODES + "CALL": 0x40, + "RETURN": 0x41, } func IsOpCode(s string) bool { @@ -76,7 +80,11 @@ func CompileInstr(s string) ([]byte, error) { } num := new(big.Int) - num.SetString(s, 0) + _, success := num.SetString(s, 0) + // Assume regular bytes during compilation + if !success { + num.SetBytes([]byte(s)) + } return num.Bytes(), nil } diff --git a/ethutil/trie_test.go b/ethutil/trie_test.go index 7c398f1de..79e5de921 100644 --- a/ethutil/trie_test.go +++ b/ethutil/trie_test.go @@ -1,6 +1,7 @@ package ethutil import ( + "fmt" "reflect" "testing" )