aboutsummaryrefslogtreecommitdiffstats
path: root/state/state_test.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-03-22 01:18:19 +0800
committerobscuren <geffobscura@gmail.com>2015-03-22 01:18:19 +0800
commit7f85608f30a2e34005c8d15566849229c758c2f1 (patch)
tree7aeb9d8bdfda7ec10ea38688a96ed245028764ad /state/state_test.go
parent09766d1729f7530093aec7e9acd3e5339b2c2028 (diff)
parentfcacfabe1959c4aff6a63cb4e275f65328660601 (diff)
downloadgo-tangerine-7f85608f30a2e34005c8d15566849229c758c2f1.tar
go-tangerine-7f85608f30a2e34005c8d15566849229c758c2f1.tar.gz
go-tangerine-7f85608f30a2e34005c8d15566849229c758c2f1.tar.bz2
go-tangerine-7f85608f30a2e34005c8d15566849229c758c2f1.tar.lz
go-tangerine-7f85608f30a2e34005c8d15566849229c758c2f1.tar.xz
go-tangerine-7f85608f30a2e34005c8d15566849229c758c2f1.tar.zst
go-tangerine-7f85608f30a2e34005c8d15566849229c758c2f1.zip
Merge branch 'conversion' into develop
Diffstat (limited to 'state/state_test.go')
-rw-r--r--state/state_test.go24
1 files changed, 11 insertions, 13 deletions
diff --git a/state/state_test.go b/state/state_test.go
index 3a1ea225d..a3d3973de 100644
--- a/state/state_test.go
+++ b/state/state_test.go
@@ -1,7 +1,6 @@
package state
import (
- "fmt"
"math/big"
"testing"
@@ -17,15 +16,16 @@ type StateSuite struct {
var _ = checker.Suite(&StateSuite{})
-// var ZeroHash256 = make([]byte, 32)
+var toAddr = common.BytesToAddress
func (s *StateSuite) TestDump(c *checker.C) {
+ return
// generate a few entries
- obj1 := s.state.GetOrNewStateObject([]byte{0x01})
+ obj1 := s.state.GetOrNewStateObject(toAddr([]byte{0x01}))
obj1.AddBalance(big.NewInt(22))
- obj2 := s.state.GetOrNewStateObject([]byte{0x01, 0x02})
+ obj2 := s.state.GetOrNewStateObject(toAddr([]byte{0x01, 0x02}))
obj2.SetCode([]byte{3, 3, 3, 3, 3, 3, 3})
- obj3 := s.state.GetOrNewStateObject([]byte{0x02})
+ obj3 := s.state.GetOrNewStateObject(toAddr([]byte{0x02}))
obj3.SetBalance(big.NewInt(44))
// write some of them to the trie
@@ -60,27 +60,25 @@ func (s *StateSuite) TestDump(c *checker.C) {
func (s *StateSuite) SetUpTest(c *checker.C) {
db, _ := ethdb.NewMemDatabase()
- s.state = New(nil, db)
+ s.state = New(common.Hash{}, db)
}
func TestNull(t *testing.T) {
db, _ := ethdb.NewMemDatabase()
- state := New(nil, db)
+ state := New(common.Hash{}, db)
- address := common.FromHex("0x823140710bf13990e4500136726d8b55")
+ address := common.HexToAddress("0x823140710bf13990e4500136726d8b55")
state.NewStateObject(address)
//value := common.FromHex("0x823140710bf13990e4500136726d8b55")
value := make([]byte, 16)
- fmt.Println("test it here", common.NewValue(value))
- state.SetState(address, []byte{0}, value)
+ state.SetState(address, common.Hash{}, value)
state.Update(nil)
state.Sync()
- value = state.GetState(address, []byte{0})
- fmt.Printf("res: %x\n", value)
+ value = state.GetState(address, common.Hash{})
}
func (s *StateSuite) TestSnapshot(c *checker.C) {
- stateobjaddr := []byte("aa")
+ stateobjaddr := toAddr([]byte("aa"))
storageaddr := common.Big("0")
data1 := common.NewValue(42)
data2 := common.NewValue(43)