aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-04-01 16:53:32 +0800
committerobscuren <geffobscura@gmail.com>2015-04-01 16:53:32 +0800
commit0a554a1f27ece4235d180373643482ceb57d90ca (patch)
tree6ab7d4cd70f7c49f64822d8e626f422158c70e78 /tests
parentd3e86f9208d775ee8020d5583d0aac8f3cfb52b2 (diff)
downloadgo-tangerine-0a554a1f27ece4235d180373643482ceb57d90ca.tar
go-tangerine-0a554a1f27ece4235d180373643482ceb57d90ca.tar.gz
go-tangerine-0a554a1f27ece4235d180373643482ceb57d90ca.tar.bz2
go-tangerine-0a554a1f27ece4235d180373643482ceb57d90ca.tar.lz
go-tangerine-0a554a1f27ece4235d180373643482ceb57d90ca.tar.xz
go-tangerine-0a554a1f27ece4235d180373643482ceb57d90ca.tar.zst
go-tangerine-0a554a1f27ece4235d180373643482ceb57d90ca.zip
Blocktest fixed, Execution fixed
* Added new CreateAccount method which properly overwrites previous accounts (excluding balance) * Fixed block tests (100% success)
Diffstat (limited to 'tests')
-rw-r--r--tests/blocktest.go13
1 files changed, 6 insertions, 7 deletions
diff --git a/tests/blocktest.go b/tests/blocktest.go
index d813ebeec..fc62eda58 100644
--- a/tests/blocktest.go
+++ b/tests/blocktest.go
@@ -4,7 +4,6 @@ import (
"bytes"
"encoding/hex"
"encoding/json"
- "errors"
"fmt"
"io/ioutil"
"math/big"
@@ -69,7 +68,7 @@ type btBlock struct {
BlockHeader *btHeader
Rlp string
Transactions []btTransaction
- UncleHeaders []string
+ UncleHeaders []*btHeader
}
type BlockTest struct {
@@ -106,13 +105,13 @@ func (t *BlockTest) InsertPreState(db common.Database) (*state.StateDB, error) {
balance, _ := new(big.Int).SetString(acct.Balance, 0)
nonce, _ := strconv.ParseUint(acct.Nonce, 16, 64)
- obj := statedb.NewStateObject(common.HexToAddress(addrString))
+ obj := statedb.CreateAccount(common.HexToAddress(addrString))
obj.SetCode(code)
obj.SetBalance(balance)
obj.SetNonce(nonce)
- // for k, v := range acct.Storage {
- // obj.SetState(k, v)
- // }
+ for k, v := range acct.Storage {
+ statedb.SetState(common.HexToAddress(addrString), common.HexToHash(k), common.FromHex(v))
+ }
}
// sync objects to trie
statedb.Update(nil)
@@ -120,7 +119,7 @@ func (t *BlockTest) InsertPreState(db common.Database) (*state.StateDB, error) {
statedb.Sync()
if !bytes.Equal(t.Genesis.Root().Bytes(), statedb.Root().Bytes()) {
- return nil, errors.New("computed state root does not match genesis block")
+ return nil, fmt.Errorf("computed state root does not match genesis block %x %x", t.Genesis.Root().Bytes()[:4], statedb.Root().Bytes()[:4])
}
return statedb, nil
}