diff options
Diffstat (limited to 'tests/vm/gh_test.go')
-rw-r--r-- | tests/vm/gh_test.go | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/tests/vm/gh_test.go b/tests/vm/gh_test.go index 1e8cd5b51..24718de7b 100644 --- a/tests/vm/gh_test.go +++ b/tests/vm/gh_test.go @@ -7,7 +7,7 @@ import ( "testing" "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/ethutil" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/state" "github.com/ethereum/go-ethereum/tests/helper" @@ -27,26 +27,26 @@ type Log struct { BloomF string `json:"bloom"` } -func (self Log) Address() []byte { return ethutil.Hex2Bytes(self.AddressF) } -func (self Log) Data() []byte { return ethutil.Hex2Bytes(self.DataF) } +func (self Log) Address() []byte { return common.Hex2Bytes(self.AddressF) } +func (self Log) Data() []byte { return common.Hex2Bytes(self.DataF) } func (self Log) RlpData() interface{} { return nil } func (self Log) Topics() [][]byte { t := make([][]byte, len(self.TopicsF)) for i, topic := range self.TopicsF { - t[i] = ethutil.Hex2Bytes(topic) + t[i] = common.Hex2Bytes(topic) } return t } -func StateObjectFromAccount(db ethutil.Database, addr string, account Account) *state.StateObject { - obj := state.NewStateObject(ethutil.Hex2Bytes(addr), db) - obj.SetBalance(ethutil.Big(account.Balance)) +func StateObjectFromAccount(db common.Database, addr string, account Account) *state.StateObject { + obj := state.NewStateObject(common.Hex2Bytes(addr), db) + obj.SetBalance(common.Big(account.Balance)) - if ethutil.IsHex(account.Code) { + if common.IsHex(account.Code) { account.Code = account.Code[2:] } - obj.SetCode(ethutil.Hex2Bytes(account.Code)) - obj.SetNonce(ethutil.Big(account.Nonce).Uint64()) + obj.SetCode(common.Hex2Bytes(account.Code)) + obj.SetNonce(common.Big(account.Nonce).Uint64()) return obj } @@ -86,7 +86,7 @@ func RunVmTest(p string, t *testing.T) { obj := StateObjectFromAccount(db, addr, account) statedb.SetStateObject(obj) for a, v := range account.Storage { - obj.SetState(helper.FromHex(a), ethutil.NewValue(helper.FromHex(v))) + obj.SetState(helper.FromHex(a), common.NewValue(helper.FromHex(v))) } } @@ -126,7 +126,7 @@ func RunVmTest(p string, t *testing.T) { if len(test.Gas) == 0 && err == nil { t.Errorf("%s's gas unspecified, indicating an error. VM returned (incorrectly) successfull", name) } else { - gexp := ethutil.Big(test.Gas) + gexp := common.Big(test.Gas) if gexp.Cmp(gas) != 0 { t.Errorf("%s's gas failed. Expected %v, got %v\n", name, gexp, gas) } @@ -140,8 +140,8 @@ func RunVmTest(p string, t *testing.T) { } if len(test.Exec) == 0 { - if obj.Balance().Cmp(ethutil.Big(account.Balance)) != 0 { - t.Errorf("%s's : (%x) balance failed. Expected %v, got %v => %v\n", name, obj.Address()[:4], account.Balance, obj.Balance(), new(big.Int).Sub(ethutil.Big(account.Balance), obj.Balance())) + if obj.Balance().Cmp(common.Big(account.Balance)) != 0 { + t.Errorf("%s's : (%x) balance failed. Expected %v, got %v => %v\n", name, obj.Address()[:4], account.Balance, obj.Balance(), new(big.Int).Sub(common.Big(account.Balance), obj.Balance())) } } @@ -150,14 +150,14 @@ func RunVmTest(p string, t *testing.T) { vexp := helper.FromHex(value) if bytes.Compare(v, vexp) != 0 { - t.Errorf("%s's : (%x: %s) storage failed. Expected %x, got %x (%v %v)\n", name, obj.Address()[0:4], addr, vexp, v, ethutil.BigD(vexp), ethutil.BigD(v)) + t.Errorf("%s's : (%x: %s) storage failed. Expected %x, got %x (%v %v)\n", name, obj.Address()[0:4], addr, vexp, v, common.BigD(vexp), common.BigD(v)) } } } if !isVmTest { statedb.Sync() - if !bytes.Equal(ethutil.Hex2Bytes(test.PostStateRoot), statedb.Root()) { + if !bytes.Equal(common.Hex2Bytes(test.PostStateRoot), statedb.Root()) { t.Errorf("%s's : Post state root error. Expected %s, got %x", name, test.PostStateRoot, statedb.Root()) } } @@ -170,8 +170,8 @@ func RunVmTest(p string, t *testing.T) { fmt.Println("A", test.Logs) fmt.Println("B", logs) for i, log := range test.Logs { - genBloom := ethutil.LeftPadBytes(types.LogsBloom(state.Logs{logs[i]}).Bytes(), 256) - if !bytes.Equal(genBloom, ethutil.Hex2Bytes(log.BloomF)) { + genBloom := common.LeftPadBytes(types.LogsBloom(state.Logs{logs[i]}).Bytes(), 256) + if !bytes.Equal(genBloom, common.Hex2Bytes(log.BloomF)) { t.Errorf("bloom mismatch") } } |