aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-11-01 08:18:13 +0800
committerobscuren <geffobscura@gmail.com>2014-11-01 08:18:13 +0800
commitc8438979a9c5c73bf68a132d5fd0325863ab454b (patch)
tree1792da4ffa92e3a225bd37079c0458ea4b101d23
parent141d3caabbfbebbbecac455462a40b6056aa3821 (diff)
parent394e0f60c20206c7f7c4c76551d11a2b14b23a4d (diff)
downloaddexon-c8438979a9c5c73bf68a132d5fd0325863ab454b.tar.gz
dexon-c8438979a9c5c73bf68a132d5fd0325863ab454b.tar.zst
dexon-c8438979a9c5c73bf68a132d5fd0325863ab454b.zip
Merge branch 'develop' of github.com-obscure:ethereum/go-ethereum into develop
-rw-r--r--.gitignore1
-rw-r--r--chain/bloom9_test.go6
-rw-r--r--chain/helper_test.go10
-rw-r--r--cmd/ethereum/main.go3
-rw-r--r--p2p/server.go4
-rw-r--r--pow/ar/block.go4
-rw-r--r--pow/ar/pow_test.go8
-rw-r--r--pow/ar/rnd.go8
-rw-r--r--state/state_test.go4
-rw-r--r--tests/ethtest/main.go8
-rw-r--r--tests/helper/init.go10
-rw-r--r--tests/helper/trie.go6
-rw-r--r--tests/helper/vm.go30
-rw-r--r--tests/vm/gh_test.go8
-rw-r--r--vm/vm_test.go36
15 files changed, 74 insertions, 72 deletions
diff --git a/.gitignore b/.gitignore
index 64dff7dd2..fea7df6c2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,3 +9,4 @@
*un~
.DS_Store
*/**/.DS_Store
+.ethtest
diff --git a/chain/bloom9_test.go b/chain/bloom9_test.go
index b5a269504..863d0adee 100644
--- a/chain/bloom9_test.go
+++ b/chain/bloom9_test.go
@@ -3,12 +3,14 @@ package chain
import (
"testing"
- "github.com/ethereum/go-ethereum/vm"
+ "github.com/ethereum/go-ethereum/state"
)
func TestBloom9(t *testing.T) {
testCase := []byte("testtest")
- bin := LogsBloom([]vm.Log{vm.Log{testCase, [][]byte{[]byte("hellohello")}, nil}}).Bytes()
+ bin := LogsBloom([]state.Log{
+ {testCase, [][]byte{[]byte("hellohello")}, nil},
+ }).Bytes()
res := BloomLookup(bin, testCase)
if !res {
diff --git a/chain/helper_test.go b/chain/helper_test.go
index 59d1c4cca..642d19c95 100644
--- a/chain/helper_test.go
+++ b/chain/helper_test.go
@@ -4,11 +4,11 @@ import (
"container/list"
"fmt"
- "github.com/ethereum/go-ethereum/ethcrypto"
+ "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/ethutil"
- "github.com/ethereum/go-ethereum/ethwire"
"github.com/ethereum/go-ethereum/event"
+ "github.com/ethereum/go-ethereum/wire"
)
// Implement our EthTest Manager
@@ -53,14 +53,14 @@ func (tm *TestManager) StateManager() *StateManager {
func (tm *TestManager) EventMux() *event.TypeMux {
return tm.eventMux
}
-func (tm *TestManager) Broadcast(msgType ethwire.MsgType, data []interface{}) {
+func (tm *TestManager) Broadcast(msgType wire.MsgType, data []interface{}) {
fmt.Println("Broadcast not implemented")
}
-func (tm *TestManager) ClientIdentity() ethwire.ClientIdentity {
+func (tm *TestManager) ClientIdentity() wire.ClientIdentity {
return nil
}
-func (tm *TestManager) KeyManager() *ethcrypto.KeyManager {
+func (tm *TestManager) KeyManager() *crypto.KeyManager {
return nil
}
diff --git a/cmd/ethereum/main.go b/cmd/ethereum/main.go
index d7bc74c27..c78972bfe 100644
--- a/cmd/ethereum/main.go
+++ b/cmd/ethereum/main.go
@@ -26,7 +26,6 @@ import (
"github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/logger"
- "github.com/ethgo.old/ethlog"
)
const (
@@ -131,5 +130,5 @@ func main() {
// this blocks the thread
ethereum.WaitForShutdown()
- ethlog.Flush()
+ logger.Flush()
}
diff --git a/p2p/server.go b/p2p/server.go
index a6bbd9260..91bc4af5c 100644
--- a/p2p/server.go
+++ b/p2p/server.go
@@ -9,7 +9,7 @@ import (
"sync"
"time"
- "github.com/ethereum/eth-go/ethlog"
+ logpkg "github.com/ethereum/go-ethereum/logger"
)
const (
@@ -93,7 +93,7 @@ type Server struct {
handlers Handlers
}
-var logger = ethlog.NewLogger("P2P")
+var logger = logpkg.NewLogger("P2P")
func New(network Network, addr net.Addr, identity ClientIdentity, handlers Handlers, maxPeers int, blacklist Blacklist) *Server {
// get alphabetical list of protocol names from handlers map
diff --git a/pow/ar/block.go b/pow/ar/block.go
index 541092f7e..2124b53b4 100644
--- a/pow/ar/block.go
+++ b/pow/ar/block.go
@@ -3,10 +3,10 @@ package ar
import (
"math/big"
- "github.com/ethereum/go-ethereum/ethtrie"
+ "github.com/ethereum/go-ethereum/trie"
)
type Block interface {
- Trie() *ethtrie.Trie
+ Trie() *trie.Trie
Diff() *big.Int
}
diff --git a/pow/ar/pow_test.go b/pow/ar/pow_test.go
index 3db9659e0..b1ebf9281 100644
--- a/pow/ar/pow_test.go
+++ b/pow/ar/pow_test.go
@@ -6,17 +6,17 @@ import (
"testing"
"github.com/ethereum/go-ethereum/ethdb"
- "github.com/ethereum/go-ethereum/ethtrie"
+ "github.com/ethereum/go-ethereum/trie"
)
type TestBlock struct {
- trie *ethtrie.Trie
+ trie *trie.Trie
}
func NewTestBlock() *TestBlock {
db, _ := ethdb.NewMemDatabase()
return &TestBlock{
- trie: ethtrie.New(db, ""),
+ trie: trie.New(db, ""),
}
}
@@ -24,7 +24,7 @@ func (self *TestBlock) Diff() *big.Int {
return b(10)
}
-func (self *TestBlock) Trie() *ethtrie.Trie {
+func (self *TestBlock) Trie() *trie.Trie {
return self.trie
}
diff --git a/pow/ar/rnd.go b/pow/ar/rnd.go
index 7dbd99373..c62f4e062 100644
--- a/pow/ar/rnd.go
+++ b/pow/ar/rnd.go
@@ -3,7 +3,7 @@ package ar
import (
"math/big"
- "github.com/ethereum/go-ethereum/ethcrypto"
+ "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethutil"
)
@@ -21,16 +21,16 @@ func (self ByteNode) Big() *big.Int {
func Sha3(v interface{}) *big.Int {
if b, ok := v.(*big.Int); ok {
- return ethutil.BigD(ethcrypto.Sha3(b.Bytes()))
+ return ethutil.BigD(crypto.Sha3(b.Bytes()))
} else if b, ok := v.([]interface{}); ok {
- return ethutil.BigD(ethcrypto.Sha3(ethutil.Encode(b)))
+ return ethutil.BigD(crypto.Sha3(ethutil.Encode(b)))
} else if s, ok := v.([]*big.Int); ok {
v := make([]interface{}, len(s))
for i, b := range s {
v[i] = b
}
- return ethutil.BigD(ethcrypto.Sha3(ethutil.Encode(v)))
+ return ethutil.BigD(crypto.Sha3(ethutil.Encode(v)))
}
return nil
diff --git a/state/state_test.go b/state/state_test.go
index 42f434ef0..737815e90 100644
--- a/state/state_test.go
+++ b/state/state_test.go
@@ -4,8 +4,8 @@ import (
"testing"
"github.com/ethereum/go-ethereum/ethdb"
- "github.com/ethereum/go-ethereum/ethtrie"
"github.com/ethereum/go-ethereum/ethutil"
+ "github.com/ethereum/go-ethereum/trie"
)
var ZeroHash256 = make([]byte, 32)
@@ -15,7 +15,7 @@ func TestSnapshot(t *testing.T) {
ethutil.ReadConfig(".ethtest", "/tmp/ethtest", "")
ethutil.Config.Db = db
- state := New(ethtrie.New(db, ""))
+ state := New(trie.New(db, ""))
stateObject := state.GetOrNewStateObject([]byte("aa"))
diff --git a/tests/ethtest/main.go b/tests/ethtest/main.go
index fb423cbd0..82fad9caf 100644
--- a/tests/ethtest/main.go
+++ b/tests/ethtest/main.go
@@ -8,8 +8,8 @@ import (
"os"
"strings"
- "github.com/ethereum/go-ethereum/ethstate"
"github.com/ethereum/go-ethereum/ethutil"
+ "github.com/ethereum/go-ethereum/state"
"github.com/ethereum/go-ethereum/tests/helper"
)
@@ -20,8 +20,8 @@ type Account struct {
Storage map[string]string
}
-func StateObjectFromAccount(addr string, account Account) *ethstate.StateObject {
- obj := ethstate.NewStateObject(ethutil.Hex2Bytes(addr))
+func StateObjectFromAccount(addr string, account Account) *state.StateObject {
+ obj := state.NewStateObject(ethutil.Hex2Bytes(addr))
obj.SetBalance(ethutil.Big(account.Balance))
if ethutil.IsHex(account.Code) {
@@ -53,7 +53,7 @@ func RunVmTest(js string) (failed int) {
}
for name, test := range tests {
- state := ethstate.New(helper.NewTrie())
+ state := state.New(helper.NewTrie())
for addr, account := range test.Pre {
obj := StateObjectFromAccount(addr, account)
state.SetStateObject(obj)
diff --git a/tests/helper/init.go b/tests/helper/init.go
index 896ed5fe0..df98b9e42 100644
--- a/tests/helper/init.go
+++ b/tests/helper/init.go
@@ -4,16 +4,16 @@ import (
"log"
"os"
- "github.com/ethereum/go-ethereum/ethlog"
"github.com/ethereum/go-ethereum/ethutil"
+ logpkg "github.com/ethereum/go-ethereum/logger"
)
-var Logger ethlog.LogSystem
-var Log = ethlog.NewLogger("TEST")
+var Logger logpkg.LogSystem
+var Log = logpkg.NewLogger("TEST")
func init() {
- Logger = ethlog.NewStdLogSystem(os.Stdout, log.LstdFlags, ethlog.InfoLevel)
- ethlog.AddLogSystem(Logger)
+ Logger = logpkg.NewStdLogSystem(os.Stdout, log.LstdFlags, logpkg.InfoLevel)
+ logpkg.AddLogSystem(Logger)
ethutil.ReadConfig(".ethtest", "/tmp/ethtest", "")
}
diff --git a/tests/helper/trie.go b/tests/helper/trie.go
index 119bac713..32432cc7a 100644
--- a/tests/helper/trie.go
+++ b/tests/helper/trie.go
@@ -1,6 +1,6 @@
package helper
-import "github.com/ethereum/go-ethereum/ethtrie"
+import "github.com/ethereum/go-ethereum/trie"
type MemDatabase struct {
db map[string][]byte
@@ -24,8 +24,8 @@ func (db *MemDatabase) Print() {}
func (db *MemDatabase) Close() {}
func (db *MemDatabase) LastKnownTD() []byte { return nil }
-func NewTrie() *ethtrie.Trie {
+func NewTrie() *trie.Trie {
db, _ := NewMemDatabase()
- return ethtrie.New(db, "")
+ return trie.New(db, "")
}
diff --git a/tests/helper/vm.go b/tests/helper/vm.go
index c56c5bae7..db71fe17e 100644
--- a/tests/helper/vm.go
+++ b/tests/helper/vm.go
@@ -3,13 +3,13 @@ package helper
import (
"math/big"
- "github.com/ethereum/go-ethereum/ethstate"
"github.com/ethereum/go-ethereum/ethutil"
+ "github.com/ethereum/go-ethereum/state"
"github.com/ethereum/go-ethereum/vm"
)
type Env struct {
- state *ethstate.State
+ state *state.State
origin []byte
parent []byte
@@ -21,13 +21,13 @@ type Env struct {
gasLimit *big.Int
}
-func NewEnv(state *ethstate.State) *Env {
+func NewEnv(state *state.State) *Env {
return &Env{
state: state,
}
}
-func NewEnvFromMap(state *ethstate.State, envValues map[string]string, exeValues map[string]string) *Env {
+func NewEnvFromMap(state *state.State, envValues map[string]string, exeValues map[string]string) *Env {
env := NewEnv(state)
env.origin = ethutil.Hex2Bytes(exeValues["caller"])
@@ -41,21 +41,21 @@ func NewEnvFromMap(state *ethstate.State, envValues map[string]string, exeValues
return env
}
-func (self *Env) Origin() []byte { return self.origin }
-func (self *Env) BlockNumber() *big.Int { return self.number }
-func (self *Env) PrevHash() []byte { return self.parent }
-func (self *Env) Coinbase() []byte { return self.coinbase }
-func (self *Env) Time() int64 { return self.time }
-func (self *Env) Difficulty() *big.Int { return self.difficulty }
-func (self *Env) BlockHash() []byte { return nil }
-func (self *Env) State() *ethstate.State { return self.state }
-func (self *Env) GasLimit() *big.Int { return self.gasLimit }
-func (self *Env) AddLog(vm.Log) {}
+func (self *Env) Origin() []byte { return self.origin }
+func (self *Env) BlockNumber() *big.Int { return self.number }
+func (self *Env) PrevHash() []byte { return self.parent }
+func (self *Env) Coinbase() []byte { return self.coinbase }
+func (self *Env) Time() int64 { return self.time }
+func (self *Env) Difficulty() *big.Int { return self.difficulty }
+func (self *Env) BlockHash() []byte { return nil }
+func (self *Env) State() *state.State { return self.state }
+func (self *Env) GasLimit() *big.Int { return self.gasLimit }
+func (self *Env) AddLog(state.Log) {}
func (self *Env) Transfer(from, to vm.Account, amount *big.Int) error {
return vm.Transfer(from, to, amount)
}
-func RunVm(state *ethstate.State, env, exec map[string]string) ([]byte, *big.Int, error) {
+func RunVm(state *state.State, env, exec map[string]string) ([]byte, *big.Int, error) {
address := FromHex(exec["address"])
caller := state.GetOrNewStateObject(FromHex(exec["caller"]))
diff --git a/tests/vm/gh_test.go b/tests/vm/gh_test.go
index 0d3c2f93d..da9de6db5 100644
--- a/tests/vm/gh_test.go
+++ b/tests/vm/gh_test.go
@@ -4,8 +4,8 @@ import (
"bytes"
"testing"
- "github.com/ethereum/go-ethereum/ethstate"
"github.com/ethereum/go-ethereum/ethutil"
+ "github.com/ethereum/go-ethereum/state"
"github.com/ethereum/go-ethereum/tests/helper"
)
@@ -16,8 +16,8 @@ type Account struct {
Storage map[string]string
}
-func StateObjectFromAccount(addr string, account Account) *ethstate.StateObject {
- obj := ethstate.NewStateObject(ethutil.Hex2Bytes(addr))
+func StateObjectFromAccount(addr string, account Account) *state.StateObject {
+ obj := state.NewStateObject(ethutil.Hex2Bytes(addr))
obj.SetBalance(ethutil.Big(account.Balance))
if ethutil.IsHex(account.Code) {
@@ -44,7 +44,7 @@ func RunVmTest(p string, t *testing.T) {
helper.CreateFileTests(t, p, &tests)
for name, test := range tests {
- state := ethstate.New(helper.NewTrie())
+ state := state.New(helper.NewTrie())
for addr, account := range test.Pre {
obj := StateObjectFromAccount(addr, account)
state.SetStateObject(obj)
diff --git a/vm/vm_test.go b/vm/vm_test.go
index 8818cc8ec..f5d77cbff 100644
--- a/vm/vm_test.go
+++ b/vm/vm_test.go
@@ -9,11 +9,11 @@ import (
"os"
"testing"
- "github.com/ethereum/go-ethereum/ethcrypto"
- "github.com/ethereum/go-ethereum/ethlog"
- "github.com/ethereum/go-ethereum/ethstate"
- "github.com/ethereum/go-ethereum/ethtrie"
+ "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethutil"
+ "github.com/ethereum/go-ethereum/logger"
+ "github.com/ethereum/go-ethereum/state"
+ "github.com/ethereum/go-ethereum/trie"
"github.com/obscuren/mutan"
)
@@ -28,15 +28,15 @@ func (TestEnv) Time() int64 { return 0 }
func (TestEnv) GasLimit() *big.Int { return nil }
func (TestEnv) Difficulty() *big.Int { return nil }
func (TestEnv) Value() *big.Int { return nil }
-func (TestEnv) AddLog(Log) {}
+func (TestEnv) AddLog(state.Log) {}
func (TestEnv) Transfer(from, to Account, amount *big.Int) error {
return nil
}
// This is likely to fail if anything ever gets looked up in the state trie :-)
-func (TestEnv) State() *ethstate.State {
- return ethstate.New(ethtrie.New(nil, ""))
+func (TestEnv) State() *state.State {
+ return state.New(trie.New(nil, ""))
}
const mutcode = `
@@ -47,18 +47,18 @@ for i := 0; i < 10; i++ {
return x`
-func setup(level ethlog.LogLevel, typ Type) (*Closure, VirtualMachine) {
+func setup(level logger.LogLevel, typ Type) (*Closure, VirtualMachine) {
code, err := ethutil.Compile(mutcode, true)
if err != nil {
log.Fatal(err)
}
// Pipe output to /dev/null
- ethlog.AddLogSystem(ethlog.NewStdLogSystem(ioutil.Discard, log.LstdFlags, level))
+ logger.AddLogSystem(logger.NewStdLogSystem(ioutil.Discard, log.LstdFlags, level))
ethutil.ReadConfig(".ethtest", "/tmp/ethtest", "")
- stateObject := ethstate.NewStateObject([]byte{'j', 'e', 'f', 'f'})
+ stateObject := state.NewStateObject([]byte{'j', 'e', 'f', 'f'})
callerClosure := NewClosure(nil, stateObject, stateObject, code, big.NewInt(1000000), big.NewInt(0))
return callerClosure, New(TestEnv{}, typ)
@@ -71,7 +71,7 @@ func TestDebugVm(t *testing.T) {
t.Skip("skipping for mutan version", mutan.Version, " < 0.6")
}
- closure, vm := setup(ethlog.DebugLevel, DebugVmTy)
+ closure, vm := setup(logger.DebugLevel, DebugVmTy)
ret, _, e := closure.Call(vm, nil)
if e != nil {
t.Fatalf("Call returned error: %v", e)
@@ -86,7 +86,7 @@ func TestVm(t *testing.T) {
t.Skip("skipping for mutan version", mutan.Version, " < 0.6")
}
- closure, vm := setup(ethlog.DebugLevel, StandardVmTy)
+ closure, vm := setup(logger.DebugLevel, StandardVmTy)
ret, _, e := closure.Call(vm, nil)
if e != nil {
t.Fatalf("Call returned error: %v", e)
@@ -97,7 +97,7 @@ func TestVm(t *testing.T) {
}
func BenchmarkDebugVm(b *testing.B) {
- closure, vm := setup(ethlog.InfoLevel, DebugVmTy)
+ closure, vm := setup(logger.InfoLevel, DebugVmTy)
b.ResetTimer()
@@ -107,7 +107,7 @@ func BenchmarkDebugVm(b *testing.B) {
}
func BenchmarkVm(b *testing.B) {
- closure, vm := setup(ethlog.InfoLevel, StandardVmTy)
+ closure, vm := setup(logger.InfoLevel, StandardVmTy)
b.ResetTimer()
@@ -122,11 +122,11 @@ func RunCode(mutCode string, typ Type) []byte {
log.Fatal(err)
}
- ethlog.AddLogSystem(ethlog.NewStdLogSystem(os.Stdout, log.LstdFlags, ethlog.InfoLevel))
+ logger.AddLogSystem(logger.NewStdLogSystem(os.Stdout, log.LstdFlags, logger.InfoLevel))
ethutil.ReadConfig(".ethtest", "/tmp/ethtest", "")
- stateObject := ethstate.NewStateObject([]byte{'j', 'e', 'f', 'f'})
+ stateObject := state.NewStateObject([]byte{'j', 'e', 'f', 'f'})
closure := NewClosure(nil, stateObject, stateObject, code, big.NewInt(1000000), big.NewInt(0))
vm := New(TestEnv{}, typ)
@@ -148,7 +148,7 @@ func TestBuildInSha256(t *testing.T) {
return out
`, DebugVmTy)
- exp := ethcrypto.Sha256(ethutil.LeftPadBytes([]byte{42}, 32))
+ exp := crypto.Sha256(ethutil.LeftPadBytes([]byte{42}, 32))
if bytes.Compare(ret, exp) != 0 {
t.Errorf("Expected %x, got %x", exp, ret)
}
@@ -164,7 +164,7 @@ func TestBuildInRipemd(t *testing.T) {
return out
`, DebugVmTy)
- exp := ethutil.RightPadBytes(ethcrypto.Ripemd160(ethutil.LeftPadBytes([]byte{42}, 32)), 32)
+ exp := ethutil.RightPadBytes(crypto.Ripemd160(ethutil.LeftPadBytes([]byte{42}, 32)), 32)
if bytes.Compare(ret, exp) != 0 {
t.Errorf("Expected %x, got %x", exp, ret)
}