forked from cerc-io/plugeth
all: fix rename breakage
This commit is contained in:
parent
5af4ff985d
commit
f3473312ba
@ -4,11 +4,11 @@ import (
|
|||||||
"container/list"
|
"container/list"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/ethcrypto"
|
"github.com/ethereum/go-ethereum/crypto"
|
||||||
"github.com/ethereum/go-ethereum/ethdb"
|
"github.com/ethereum/go-ethereum/ethdb"
|
||||||
"github.com/ethereum/go-ethereum/ethutil"
|
"github.com/ethereum/go-ethereum/ethutil"
|
||||||
"github.com/ethereum/go-ethereum/ethwire"
|
|
||||||
"github.com/ethereum/go-ethereum/event"
|
"github.com/ethereum/go-ethereum/event"
|
||||||
|
"github.com/ethereum/go-ethereum/wire"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Implement our EthTest Manager
|
// Implement our EthTest Manager
|
||||||
@ -53,14 +53,14 @@ func (tm *TestManager) StateManager() *StateManager {
|
|||||||
func (tm *TestManager) EventMux() *event.TypeMux {
|
func (tm *TestManager) EventMux() *event.TypeMux {
|
||||||
return tm.eventMux
|
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")
|
fmt.Println("Broadcast not implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tm *TestManager) ClientIdentity() ethwire.ClientIdentity {
|
func (tm *TestManager) ClientIdentity() wire.ClientIdentity {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
func (tm *TestManager) KeyManager() *ethcrypto.KeyManager {
|
func (tm *TestManager) KeyManager() *crypto.KeyManager {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,6 @@ import (
|
|||||||
"github.com/ethereum/go-ethereum/cmd/utils"
|
"github.com/ethereum/go-ethereum/cmd/utils"
|
||||||
"github.com/ethereum/go-ethereum/ethutil"
|
"github.com/ethereum/go-ethereum/ethutil"
|
||||||
"github.com/ethereum/go-ethereum/logger"
|
"github.com/ethereum/go-ethereum/logger"
|
||||||
"github.com/ethgo.old/ethlog"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -131,5 +130,5 @@ func main() {
|
|||||||
|
|
||||||
// this blocks the thread
|
// this blocks the thread
|
||||||
ethereum.WaitForShutdown()
|
ethereum.WaitForShutdown()
|
||||||
ethlog.Flush()
|
logger.Flush()
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/ethereum/eth-go/ethlog"
|
logpkg "github.com/ethereum/go-ethereum/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -93,7 +93,7 @@ type Server struct {
|
|||||||
handlers Handlers
|
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 {
|
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
|
// get alphabetical list of protocol names from handlers map
|
||||||
|
@ -3,10 +3,10 @@ package ar
|
|||||||
import (
|
import (
|
||||||
"math/big"
|
"math/big"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/ethtrie"
|
"github.com/ethereum/go-ethereum/trie"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Block interface {
|
type Block interface {
|
||||||
Trie() *ethtrie.Trie
|
Trie() *trie.Trie
|
||||||
Diff() *big.Int
|
Diff() *big.Int
|
||||||
}
|
}
|
||||||
|
@ -6,17 +6,17 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/ethdb"
|
"github.com/ethereum/go-ethereum/ethdb"
|
||||||
"github.com/ethereum/go-ethereum/ethtrie"
|
"github.com/ethereum/go-ethereum/trie"
|
||||||
)
|
)
|
||||||
|
|
||||||
type TestBlock struct {
|
type TestBlock struct {
|
||||||
trie *ethtrie.Trie
|
trie *trie.Trie
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewTestBlock() *TestBlock {
|
func NewTestBlock() *TestBlock {
|
||||||
db, _ := ethdb.NewMemDatabase()
|
db, _ := ethdb.NewMemDatabase()
|
||||||
return &TestBlock{
|
return &TestBlock{
|
||||||
trie: ethtrie.New(db, ""),
|
trie: trie.New(db, ""),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24,7 +24,7 @@ func (self *TestBlock) Diff() *big.Int {
|
|||||||
return b(10)
|
return b(10)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *TestBlock) Trie() *ethtrie.Trie {
|
func (self *TestBlock) Trie() *trie.Trie {
|
||||||
return self.trie
|
return self.trie
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ package ar
|
|||||||
import (
|
import (
|
||||||
"math/big"
|
"math/big"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/ethcrypto"
|
"github.com/ethereum/go-ethereum/crypto"
|
||||||
"github.com/ethereum/go-ethereum/ethutil"
|
"github.com/ethereum/go-ethereum/ethutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -21,16 +21,16 @@ func (self ByteNode) Big() *big.Int {
|
|||||||
|
|
||||||
func Sha3(v interface{}) *big.Int {
|
func Sha3(v interface{}) *big.Int {
|
||||||
if b, ok := v.(*big.Int); ok {
|
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 {
|
} 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 {
|
} else if s, ok := v.([]*big.Int); ok {
|
||||||
v := make([]interface{}, len(s))
|
v := make([]interface{}, len(s))
|
||||||
for i, b := range s {
|
for i, b := range s {
|
||||||
v[i] = b
|
v[i] = b
|
||||||
}
|
}
|
||||||
|
|
||||||
return ethutil.BigD(ethcrypto.Sha3(ethutil.Encode(v)))
|
return ethutil.BigD(crypto.Sha3(ethutil.Encode(v)))
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -4,8 +4,8 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/ethdb"
|
"github.com/ethereum/go-ethereum/ethdb"
|
||||||
"github.com/ethereum/go-ethereum/ethtrie"
|
|
||||||
"github.com/ethereum/go-ethereum/ethutil"
|
"github.com/ethereum/go-ethereum/ethutil"
|
||||||
|
"github.com/ethereum/go-ethereum/trie"
|
||||||
)
|
)
|
||||||
|
|
||||||
var ZeroHash256 = make([]byte, 32)
|
var ZeroHash256 = make([]byte, 32)
|
||||||
@ -15,7 +15,7 @@ func TestSnapshot(t *testing.T) {
|
|||||||
ethutil.ReadConfig(".ethtest", "/tmp/ethtest", "")
|
ethutil.ReadConfig(".ethtest", "/tmp/ethtest", "")
|
||||||
ethutil.Config.Db = db
|
ethutil.Config.Db = db
|
||||||
|
|
||||||
state := New(ethtrie.New(db, ""))
|
state := New(trie.New(db, ""))
|
||||||
|
|
||||||
stateObject := state.GetOrNewStateObject([]byte("aa"))
|
stateObject := state.GetOrNewStateObject([]byte("aa"))
|
||||||
|
|
||||||
|
@ -8,8 +8,8 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/ethstate"
|
|
||||||
"github.com/ethereum/go-ethereum/ethutil"
|
"github.com/ethereum/go-ethereum/ethutil"
|
||||||
|
"github.com/ethereum/go-ethereum/state"
|
||||||
"github.com/ethereum/go-ethereum/tests/helper"
|
"github.com/ethereum/go-ethereum/tests/helper"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -20,8 +20,8 @@ type Account struct {
|
|||||||
Storage map[string]string
|
Storage map[string]string
|
||||||
}
|
}
|
||||||
|
|
||||||
func StateObjectFromAccount(addr string, account Account) *ethstate.StateObject {
|
func StateObjectFromAccount(addr string, account Account) *state.StateObject {
|
||||||
obj := ethstate.NewStateObject(ethutil.Hex2Bytes(addr))
|
obj := state.NewStateObject(ethutil.Hex2Bytes(addr))
|
||||||
obj.SetBalance(ethutil.Big(account.Balance))
|
obj.SetBalance(ethutil.Big(account.Balance))
|
||||||
|
|
||||||
if ethutil.IsHex(account.Code) {
|
if ethutil.IsHex(account.Code) {
|
||||||
@ -53,7 +53,7 @@ func RunVmTest(js string) (failed int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for name, test := range tests {
|
for name, test := range tests {
|
||||||
state := ethstate.New(helper.NewTrie())
|
state := state.New(helper.NewTrie())
|
||||||
for addr, account := range test.Pre {
|
for addr, account := range test.Pre {
|
||||||
obj := StateObjectFromAccount(addr, account)
|
obj := StateObjectFromAccount(addr, account)
|
||||||
state.SetStateObject(obj)
|
state.SetStateObject(obj)
|
||||||
|
@ -4,16 +4,16 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/ethlog"
|
|
||||||
"github.com/ethereum/go-ethereum/ethutil"
|
"github.com/ethereum/go-ethereum/ethutil"
|
||||||
|
logpkg "github.com/ethereum/go-ethereum/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
var Logger ethlog.LogSystem
|
var Logger logpkg.LogSystem
|
||||||
var Log = ethlog.NewLogger("TEST")
|
var Log = logpkg.NewLogger("TEST")
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Logger = ethlog.NewStdLogSystem(os.Stdout, log.LstdFlags, ethlog.InfoLevel)
|
Logger = logpkg.NewStdLogSystem(os.Stdout, log.LstdFlags, logpkg.InfoLevel)
|
||||||
ethlog.AddLogSystem(Logger)
|
logpkg.AddLogSystem(Logger)
|
||||||
|
|
||||||
ethutil.ReadConfig(".ethtest", "/tmp/ethtest", "")
|
ethutil.ReadConfig(".ethtest", "/tmp/ethtest", "")
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package helper
|
package helper
|
||||||
|
|
||||||
import "github.com/ethereum/go-ethereum/ethtrie"
|
import "github.com/ethereum/go-ethereum/trie"
|
||||||
|
|
||||||
type MemDatabase struct {
|
type MemDatabase struct {
|
||||||
db map[string][]byte
|
db map[string][]byte
|
||||||
@ -24,8 +24,8 @@ func (db *MemDatabase) Print() {}
|
|||||||
func (db *MemDatabase) Close() {}
|
func (db *MemDatabase) Close() {}
|
||||||
func (db *MemDatabase) LastKnownTD() []byte { return nil }
|
func (db *MemDatabase) LastKnownTD() []byte { return nil }
|
||||||
|
|
||||||
func NewTrie() *ethtrie.Trie {
|
func NewTrie() *trie.Trie {
|
||||||
db, _ := NewMemDatabase()
|
db, _ := NewMemDatabase()
|
||||||
|
|
||||||
return ethtrie.New(db, "")
|
return trie.New(db, "")
|
||||||
}
|
}
|
||||||
|
@ -3,13 +3,13 @@ package helper
|
|||||||
import (
|
import (
|
||||||
"math/big"
|
"math/big"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/ethstate"
|
|
||||||
"github.com/ethereum/go-ethereum/ethutil"
|
"github.com/ethereum/go-ethereum/ethutil"
|
||||||
|
"github.com/ethereum/go-ethereum/state"
|
||||||
"github.com/ethereum/go-ethereum/vm"
|
"github.com/ethereum/go-ethereum/vm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Env struct {
|
type Env struct {
|
||||||
state *ethstate.State
|
state *state.State
|
||||||
|
|
||||||
origin []byte
|
origin []byte
|
||||||
parent []byte
|
parent []byte
|
||||||
@ -21,13 +21,13 @@ type Env struct {
|
|||||||
gasLimit *big.Int
|
gasLimit *big.Int
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewEnv(state *ethstate.State) *Env {
|
func NewEnv(state *state.State) *Env {
|
||||||
return &Env{
|
return &Env{
|
||||||
state: state,
|
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 := NewEnv(state)
|
||||||
|
|
||||||
env.origin = ethutil.Hex2Bytes(exeValues["caller"])
|
env.origin = ethutil.Hex2Bytes(exeValues["caller"])
|
||||||
@ -48,14 +48,14 @@ func (self *Env) Coinbase() []byte { return self.coinbase }
|
|||||||
func (self *Env) Time() int64 { return self.time }
|
func (self *Env) Time() int64 { return self.time }
|
||||||
func (self *Env) Difficulty() *big.Int { return self.difficulty }
|
func (self *Env) Difficulty() *big.Int { return self.difficulty }
|
||||||
func (self *Env) BlockHash() []byte { return nil }
|
func (self *Env) BlockHash() []byte { return nil }
|
||||||
func (self *Env) State() *ethstate.State { return self.state }
|
func (self *Env) State() *state.State { return self.state }
|
||||||
func (self *Env) GasLimit() *big.Int { return self.gasLimit }
|
func (self *Env) GasLimit() *big.Int { return self.gasLimit }
|
||||||
func (self *Env) AddLog(vm.Log) {}
|
func (self *Env) AddLog(vm.Log) {}
|
||||||
func (self *Env) Transfer(from, to vm.Account, amount *big.Int) error {
|
func (self *Env) Transfer(from, to vm.Account, amount *big.Int) error {
|
||||||
return vm.Transfer(from, to, amount)
|
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"])
|
address := FromHex(exec["address"])
|
||||||
caller := state.GetOrNewStateObject(FromHex(exec["caller"]))
|
caller := state.GetOrNewStateObject(FromHex(exec["caller"]))
|
||||||
|
|
||||||
|
@ -4,8 +4,8 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/ethstate"
|
|
||||||
"github.com/ethereum/go-ethereum/ethutil"
|
"github.com/ethereum/go-ethereum/ethutil"
|
||||||
|
"github.com/ethereum/go-ethereum/state"
|
||||||
"github.com/ethereum/go-ethereum/tests/helper"
|
"github.com/ethereum/go-ethereum/tests/helper"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -16,8 +16,8 @@ type Account struct {
|
|||||||
Storage map[string]string
|
Storage map[string]string
|
||||||
}
|
}
|
||||||
|
|
||||||
func StateObjectFromAccount(addr string, account Account) *ethstate.StateObject {
|
func StateObjectFromAccount(addr string, account Account) *state.StateObject {
|
||||||
obj := ethstate.NewStateObject(ethutil.Hex2Bytes(addr))
|
obj := state.NewStateObject(ethutil.Hex2Bytes(addr))
|
||||||
obj.SetBalance(ethutil.Big(account.Balance))
|
obj.SetBalance(ethutil.Big(account.Balance))
|
||||||
|
|
||||||
if ethutil.IsHex(account.Code) {
|
if ethutil.IsHex(account.Code) {
|
||||||
@ -44,7 +44,7 @@ func RunVmTest(p string, t *testing.T) {
|
|||||||
helper.CreateFileTests(t, p, &tests)
|
helper.CreateFileTests(t, p, &tests)
|
||||||
|
|
||||||
for name, test := range tests {
|
for name, test := range tests {
|
||||||
state := ethstate.New(helper.NewTrie())
|
state := state.New(helper.NewTrie())
|
||||||
for addr, account := range test.Pre {
|
for addr, account := range test.Pre {
|
||||||
obj := StateObjectFromAccount(addr, account)
|
obj := StateObjectFromAccount(addr, account)
|
||||||
state.SetStateObject(obj)
|
state.SetStateObject(obj)
|
||||||
|
@ -9,11 +9,11 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/ethcrypto"
|
"github.com/ethereum/go-ethereum/crypto"
|
||||||
"github.com/ethereum/go-ethereum/ethlog"
|
|
||||||
"github.com/ethereum/go-ethereum/ethstate"
|
|
||||||
"github.com/ethereum/go-ethereum/ethtrie"
|
|
||||||
"github.com/ethereum/go-ethereum/ethutil"
|
"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"
|
"github.com/obscuren/mutan"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -35,8 +35,8 @@ func (TestEnv) Transfer(from, to Account, amount *big.Int) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// This is likely to fail if anything ever gets looked up in the state trie :-)
|
// This is likely to fail if anything ever gets looked up in the state trie :-)
|
||||||
func (TestEnv) State() *ethstate.State {
|
func (TestEnv) State() *state.State {
|
||||||
return ethstate.New(ethtrie.New(nil, ""))
|
return state.New(trie.New(nil, ""))
|
||||||
}
|
}
|
||||||
|
|
||||||
const mutcode = `
|
const mutcode = `
|
||||||
@ -47,18 +47,18 @@ for i := 0; i < 10; i++ {
|
|||||||
|
|
||||||
return x`
|
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)
|
code, err := ethutil.Compile(mutcode, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pipe output to /dev/null
|
// 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", "")
|
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))
|
callerClosure := NewClosure(nil, stateObject, stateObject, code, big.NewInt(1000000), big.NewInt(0))
|
||||||
|
|
||||||
return callerClosure, New(TestEnv{}, typ)
|
return callerClosure, New(TestEnv{}, typ)
|
||||||
@ -71,7 +71,7 @@ func TestDebugVm(t *testing.T) {
|
|||||||
t.Skip("skipping for mutan version", mutan.Version, " < 0.6")
|
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)
|
ret, _, e := closure.Call(vm, nil)
|
||||||
if e != nil {
|
if e != nil {
|
||||||
t.Fatalf("Call returned error: %v", e)
|
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")
|
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)
|
ret, _, e := closure.Call(vm, nil)
|
||||||
if e != nil {
|
if e != nil {
|
||||||
t.Fatalf("Call returned error: %v", e)
|
t.Fatalf("Call returned error: %v", e)
|
||||||
@ -97,7 +97,7 @@ func TestVm(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func BenchmarkDebugVm(b *testing.B) {
|
func BenchmarkDebugVm(b *testing.B) {
|
||||||
closure, vm := setup(ethlog.InfoLevel, DebugVmTy)
|
closure, vm := setup(logger.InfoLevel, DebugVmTy)
|
||||||
|
|
||||||
b.ResetTimer()
|
b.ResetTimer()
|
||||||
|
|
||||||
@ -107,7 +107,7 @@ func BenchmarkDebugVm(b *testing.B) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func BenchmarkVm(b *testing.B) {
|
func BenchmarkVm(b *testing.B) {
|
||||||
closure, vm := setup(ethlog.InfoLevel, StandardVmTy)
|
closure, vm := setup(logger.InfoLevel, StandardVmTy)
|
||||||
|
|
||||||
b.ResetTimer()
|
b.ResetTimer()
|
||||||
|
|
||||||
@ -122,11 +122,11 @@ func RunCode(mutCode string, typ Type) []byte {
|
|||||||
log.Fatal(err)
|
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", "")
|
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))
|
closure := NewClosure(nil, stateObject, stateObject, code, big.NewInt(1000000), big.NewInt(0))
|
||||||
|
|
||||||
vm := New(TestEnv{}, typ)
|
vm := New(TestEnv{}, typ)
|
||||||
@ -148,7 +148,7 @@ func TestBuildInSha256(t *testing.T) {
|
|||||||
return out
|
return out
|
||||||
`, DebugVmTy)
|
`, DebugVmTy)
|
||||||
|
|
||||||
exp := ethcrypto.Sha256(ethutil.LeftPadBytes([]byte{42}, 32))
|
exp := crypto.Sha256(ethutil.LeftPadBytes([]byte{42}, 32))
|
||||||
if bytes.Compare(ret, exp) != 0 {
|
if bytes.Compare(ret, exp) != 0 {
|
||||||
t.Errorf("Expected %x, got %x", exp, ret)
|
t.Errorf("Expected %x, got %x", exp, ret)
|
||||||
}
|
}
|
||||||
@ -164,7 +164,7 @@ func TestBuildInRipemd(t *testing.T) {
|
|||||||
return out
|
return out
|
||||||
`, DebugVmTy)
|
`, 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 {
|
if bytes.Compare(ret, exp) != 0 {
|
||||||
t.Errorf("Expected %x, got %x", exp, ret)
|
t.Errorf("Expected %x, got %x", exp, ret)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user