Merge pull request #1814 from Gustav-Simonsson/common_tests

tests: update common test wrappers and test files
This commit is contained in:
Jeffrey Wilcke 2015-09-18 16:34:54 -07:00
commit e40b447fea
8 changed files with 13127 additions and 439 deletions

@ -111,25 +111,27 @@ func runOneBlockTest(ctx *cli.Context, test *tests.BlockTest) (*eth.Ethereum, er
if err != nil {
return nil, err
}
// if err := ethereum.Start(); err != nil {
// return nil, err
// }
// import the genesis block
ethereum.ResetWithGenesisBlock(test.Genesis)
// import pre accounts
statedb, err := test.InsertPreState(ethereum)
_, err = test.InsertPreState(ethereum)
if err != nil {
return ethereum, fmt.Errorf("InsertPreState: %v", err)
}
if err := test.TryBlocksInsert(ethereum.ChainManager()); err != nil {
cm := ethereum.ChainManager()
validBlocks, err := test.TryBlocksInsert(cm)
if err != nil {
return ethereum, fmt.Errorf("Block Test load error: %v", err)
}
if err := test.ValidatePostState(statedb); err != nil {
newDB := cm.State()
if err := test.ValidatePostState(newDB); err != nil {
return ethereum, fmt.Errorf("post state validation failed: %v", err)
}
return ethereum, nil
return ethereum, test.ValidateImportedHeaders(cm, validBlocks)
}

@ -44,8 +44,10 @@ import (
type BlockTest struct {
Genesis *types.Block
Json *btJSON
preAccounts map[string]btAccount
Json *btJSON
preAccounts map[string]btAccount
postAccounts map[string]btAccount
lastblockhash string
}
type btJSON struct {
@ -53,6 +55,7 @@ type btJSON struct {
GenesisBlockHeader btHeader
Pre map[string]btAccount
PostState map[string]btAccount
Lastblockhash string
}
type btBlock struct {
@ -76,6 +79,7 @@ type btHeader struct {
MixHash string
Nonce string
Number string
Hash string
ParentHash string
ReceiptTrie string
SeedHash string
@ -147,7 +151,6 @@ func runBlockTests(bt map[string]*BlockTest, skipTests []string) error {
glog.Infoln("Skipping block test", name)
continue
}
// test the block
if err := runBlockTest(test); err != nil {
return fmt.Errorf("%s: %v", name, err)
@ -173,20 +176,29 @@ func runBlockTest(test *BlockTest) error {
}
// import pre accounts
statedb, err := test.InsertPreState(ethereum)
_, err = test.InsertPreState(ethereum)
if err != nil {
return fmt.Errorf("InsertPreState: %v", err)
}
err = test.TryBlocksInsert(ethereum.ChainManager())
cm := ethereum.ChainManager()
validBlocks, err := test.TryBlocksInsert(cm)
if err != nil {
return err
}
if err = test.ValidatePostState(statedb); err != nil {
lastblockhash := common.HexToHash(test.lastblockhash)
cmlast := cm.LastBlockHash()
if lastblockhash != cmlast {
return fmt.Errorf("lastblockhash validation mismatch: want: %x, have: %x", lastblockhash, cmlast)
}
newDB := cm.State()
if err = test.ValidatePostState(newDB); err != nil {
return fmt.Errorf("post state validation failed: %v", err)
}
return nil
return test.ValidateImportedHeaders(cm, validBlocks)
}
func (test *BlockTest) makeEthConfig() *eth.Config {
@ -264,7 +276,8 @@ func (t *BlockTest) InsertPreState(ethereum *eth.Ethereum) (*state.StateDB, erro
expected we are expected to ignore it and continue processing and then validate the
post state.
*/
func (t *BlockTest) TryBlocksInsert(chainManager *core.ChainManager) error {
func (t *BlockTest) TryBlocksInsert(chainManager *core.ChainManager) ([]btBlock, error) {
validBlocks := make([]btBlock, 0)
// insert the test blocks, which will execute all transactions
for _, b := range t.Json.Blocks {
cb, err := mustConvertBlock(b)
@ -272,7 +285,7 @@ func (t *BlockTest) TryBlocksInsert(chainManager *core.ChainManager) error {
if b.BlockHeader == nil {
continue // OK - block is supposed to be invalid, continue with next block
} else {
return fmt.Errorf("Block RLP decoding failed when expected to succeed: %v", err)
return nil, fmt.Errorf("Block RLP decoding failed when expected to succeed: %v", err)
}
}
// RLP decoding worked, try to insert into chain:
@ -281,100 +294,103 @@ func (t *BlockTest) TryBlocksInsert(chainManager *core.ChainManager) error {
if b.BlockHeader == nil {
continue // OK - block is supposed to be invalid, continue with next block
} else {
return fmt.Errorf("Block insertion into chain failed: %v", err)
return nil, fmt.Errorf("Block insertion into chain failed: %v", err)
}
}
if b.BlockHeader == nil {
return fmt.Errorf("Block insertion should have failed")
return nil, fmt.Errorf("Block insertion should have failed")
}
err = t.validateBlockHeader(b.BlockHeader, cb.Header())
if err != nil {
return fmt.Errorf("Block header validation failed: %v", err)
// validate RLP decoding by checking all values against test file JSON
if err = validateHeader(b.BlockHeader, cb.Header()); err != nil {
return nil, fmt.Errorf("Deserialised block header validation failed: %v", err)
}
validBlocks = append(validBlocks, b)
}
return nil
return validBlocks, nil
}
func (s *BlockTest) validateBlockHeader(h *btHeader, h2 *types.Header) error {
func validateHeader(h *btHeader, h2 *types.Header) error {
expectedBloom := mustConvertBytes(h.Bloom)
if !bytes.Equal(expectedBloom, h2.Bloom.Bytes()) {
return fmt.Errorf("Bloom: expected: %v, decoded: %v", expectedBloom, h2.Bloom.Bytes())
return fmt.Errorf("Bloom: want: %x have: %x", expectedBloom, h2.Bloom.Bytes())
}
expectedCoinbase := mustConvertBytes(h.Coinbase)
if !bytes.Equal(expectedCoinbase, h2.Coinbase.Bytes()) {
return fmt.Errorf("Coinbase: expected: %v, decoded: %v", expectedCoinbase, h2.Coinbase.Bytes())
return fmt.Errorf("Coinbase: want: %x have: %x", expectedCoinbase, h2.Coinbase.Bytes())
}
expectedMixHashBytes := mustConvertBytes(h.MixHash)
if !bytes.Equal(expectedMixHashBytes, h2.MixDigest.Bytes()) {
return fmt.Errorf("MixHash: expected: %v, decoded: %v", expectedMixHashBytes, h2.MixDigest.Bytes())
return fmt.Errorf("MixHash: want: %x have: %x", expectedMixHashBytes, h2.MixDigest.Bytes())
}
expectedNonce := mustConvertBytes(h.Nonce)
if !bytes.Equal(expectedNonce, h2.Nonce[:]) {
return fmt.Errorf("Nonce: expected: %v, decoded: %v", expectedNonce, h2.Nonce)
return fmt.Errorf("Nonce: want: %x have: %x", expectedNonce, h2.Nonce)
}
expectedNumber := mustConvertBigInt(h.Number, 16)
if expectedNumber.Cmp(h2.Number) != 0 {
return fmt.Errorf("Number: expected: %v, decoded: %v", expectedNumber, h2.Number)
return fmt.Errorf("Number: want: %v have: %v", expectedNumber, h2.Number)
}
expectedParentHash := mustConvertBytes(h.ParentHash)
if !bytes.Equal(expectedParentHash, h2.ParentHash.Bytes()) {
return fmt.Errorf("Parent hash: expected: %v, decoded: %v", expectedParentHash, h2.ParentHash.Bytes())
return fmt.Errorf("Parent hash: want: %x have: %x", expectedParentHash, h2.ParentHash.Bytes())
}
expectedReceiptHash := mustConvertBytes(h.ReceiptTrie)
if !bytes.Equal(expectedReceiptHash, h2.ReceiptHash.Bytes()) {
return fmt.Errorf("Receipt hash: expected: %v, decoded: %v", expectedReceiptHash, h2.ReceiptHash.Bytes())
return fmt.Errorf("Receipt hash: want: %x have: %x", expectedReceiptHash, h2.ReceiptHash.Bytes())
}
expectedTxHash := mustConvertBytes(h.TransactionsTrie)
if !bytes.Equal(expectedTxHash, h2.TxHash.Bytes()) {
return fmt.Errorf("Tx hash: expected: %v, decoded: %v", expectedTxHash, h2.TxHash.Bytes())
return fmt.Errorf("Tx hash: want: %x have: %x", expectedTxHash, h2.TxHash.Bytes())
}
expectedStateHash := mustConvertBytes(h.StateRoot)
if !bytes.Equal(expectedStateHash, h2.Root.Bytes()) {
return fmt.Errorf("State hash: expected: %v, decoded: %v", expectedStateHash, h2.Root.Bytes())
return fmt.Errorf("State hash: want: %x have: %x", expectedStateHash, h2.Root.Bytes())
}
expectedUncleHash := mustConvertBytes(h.UncleHash)
if !bytes.Equal(expectedUncleHash, h2.UncleHash.Bytes()) {
return fmt.Errorf("Uncle hash: expected: %v, decoded: %v", expectedUncleHash, h2.UncleHash.Bytes())
return fmt.Errorf("Uncle hash: want: %x have: %x", expectedUncleHash, h2.UncleHash.Bytes())
}
expectedExtraData := mustConvertBytes(h.ExtraData)
if !bytes.Equal(expectedExtraData, h2.Extra) {
return fmt.Errorf("Extra data: expected: %v, decoded: %v", expectedExtraData, h2.Extra)
return fmt.Errorf("Extra data: want: %x have: %x", expectedExtraData, h2.Extra)
}
expectedDifficulty := mustConvertBigInt(h.Difficulty, 16)
if expectedDifficulty.Cmp(h2.Difficulty) != 0 {
return fmt.Errorf("Difficulty: expected: %v, decoded: %v", expectedDifficulty, h2.Difficulty)
return fmt.Errorf("Difficulty: want: %v have: %v", expectedDifficulty, h2.Difficulty)
}
expectedGasLimit := mustConvertBigInt(h.GasLimit, 16)
if expectedGasLimit.Cmp(h2.GasLimit) != 0 {
return fmt.Errorf("GasLimit: expected: %v, decoded: %v", expectedGasLimit, h2.GasLimit)
return fmt.Errorf("GasLimit: want: %v have: %v", expectedGasLimit, h2.GasLimit)
}
expectedGasUsed := mustConvertBigInt(h.GasUsed, 16)
if expectedGasUsed.Cmp(h2.GasUsed) != 0 {
return fmt.Errorf("GasUsed: expected: %v, decoded: %v", expectedGasUsed, h2.GasUsed)
return fmt.Errorf("GasUsed: want: %v have: %v", expectedGasUsed, h2.GasUsed)
}
expectedTimestamp := mustConvertBigInt(h.Timestamp, 16)
if expectedTimestamp.Cmp(h2.Time) != 0 {
return fmt.Errorf("Timestamp: expected: %v, decoded: %v", expectedTimestamp, h2.Time)
return fmt.Errorf("Timestamp: want: %v have: %v", expectedTimestamp, h2.Time)
}
return nil
}
func (t *BlockTest) ValidatePostState(statedb *state.StateDB) error {
for addrString, acct := range t.preAccounts {
// validate post state accounts in test file against what we have in state db
for addrString, acct := range t.postAccounts {
// XXX: is is worth it checking for errors here?
addr, err := hex.DecodeString(addrString)
if err != nil {
@ -398,13 +414,34 @@ func (t *BlockTest) ValidatePostState(statedb *state.StateDB) error {
balance2 := statedb.GetBalance(common.BytesToAddress(addr))
nonce2 := statedb.GetNonce(common.BytesToAddress(addr))
if !bytes.Equal(code2, code) {
return fmt.Errorf("account code mismatch, addr, found, expected: ", addrString, hex.EncodeToString(code2), hex.EncodeToString(code))
return fmt.Errorf("account code mismatch for addr: %s want: %s have: %s", addrString, hex.EncodeToString(code), hex.EncodeToString(code2))
}
if balance2.Cmp(balance) != 0 {
return fmt.Errorf("account balance mismatch, addr, found, expected: ", addrString, balance2, balance)
return fmt.Errorf("account balance mismatch for addr: %s, want: %d, have: %d", addrString, balance, balance2)
}
if nonce2 != nonce {
return fmt.Errorf("account nonce mismatch, addr, found, expected: ", addrString, nonce2, nonce)
return fmt.Errorf("account nonce mismatch for addr: %s want: %d have: %d", addrString, nonce, nonce2)
}
}
return nil
}
func (test *BlockTest) ValidateImportedHeaders(cm *core.ChainManager, validBlocks []btBlock) error {
// to get constant lookup when verifying block headers by hash (some tests have many blocks)
bmap := make(map[string]btBlock, len(test.Json.Blocks))
for _, b := range validBlocks {
bmap[b.BlockHeader.Hash] = b
}
// iterate over blocks backwards from HEAD and validate imported
// headers vs test file. some tests have reorgs, and we import
// block-by-block, so we can only validate imported headers after
// all blocks have been processed by ChainManager, as they may not
// be part of the longest chain until last block is imported.
for b := cm.CurrentBlock(); b != nil && b.NumberU64() != 0; b = cm.GetBlock(b.Header().ParentHash) {
bHash := common.Bytes2Hex(b.Hash().Bytes()) // hex without 0x prefix
if err := validateHeader(bmap[bHash].BlockHeader, b.Header()); err != nil {
return fmt.Errorf("Imported block header validation failed: %v", err)
}
}
return nil
@ -432,7 +469,7 @@ func convertBlockTest(in *btJSON) (out *BlockTest, err error) {
err = fmt.Errorf("%v\n%s", recovered, buf)
}
}()
out = &BlockTest{preAccounts: in.Pre, Json: in}
out = &BlockTest{preAccounts: in.Pre, postAccounts: in.PostState, Json: in, lastblockhash: in.Lastblockhash}
out.Genesis = mustConvertGenesis(in.GenesisBlockHeader)
return out, err
}

File diff suppressed because it is too large Load Diff

@ -4826,23 +4826,23 @@
"lastblockhash" : "eed1b4da708283370856fc76352d68f36d9766b7f366da372e2992ced9a1f663",
"postState" : {
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
"balance" : "0x14",
"balance" : "0x1e",
"code" : "0x",
"nonce" : "0x00",
"storage" : {
}
},
"8888f1f195afa192cfee860698584c030f4c9db1" : {
"balance" : "0x8ac7230489e8a410",
"balance" : "0xd255d112e1049618",
"code" : "0x",
"nonce" : "0x00",
"storage" : {
}
},
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
"balance" : "0x09184e71fbdc",
"balance" : "0x09184e71a9ca",
"code" : "0x",
"nonce" : "0x02",
"nonce" : "0x03",
"storage" : {
}
}

@ -375,6 +375,252 @@
}
}
},
"SuicideCoinbase" : {
"blocks" : [
{
"blockHeader" : {
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1",
"difficulty" : "0x020000",
"extraData" : "0x",
"gasLimit" : "0x2fefd8",
"gasUsed" : "0xcdc7",
"hash" : "b1ff798f6f2a8c617f75b265e00ec67fab2f1e6076359d3332d99e8f69688850",
"mixHash" : "f9192b11328b47b77fc4765f3ec74ab433d63a01095ed77e3f82627766a491bc",
"nonce" : "97c55a07ab25b5fe",
"number" : "0x01",
"parentHash" : "363315d12ad724ec43a5400affb35e66e0b94bc40c6150b2870f76563a7703a7",
"receiptTrie" : "56e592ae6cf92b6c205e50d9cdbf1d3c5fe7f9fbc2bf219b93855107518e7e7f",
"stateRoot" : "7564aa479e81b3f9a05b0f99193fdd7367ccc0e74d140249d943ce0df904ba02",
"timestamp" : "0x55e5b3e8",
"transactionsTrie" : "fcfe9f2203bd98342867117fa3de299a09578371efd04fc9e76a46f7f1fda4bb",
"uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
},
"rlp" : "0xf9032ef901f9a0363315d12ad724ec43a5400affb35e66e0b94bc40c6150b2870f76563a7703a7a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a07564aa479e81b3f9a05b0f99193fdd7367ccc0e74d140249d943ce0df904ba02a0fcfe9f2203bd98342867117fa3de299a09578371efd04fc9e76a46f7f1fda4bba056e592ae6cf92b6c205e50d9cdbf1d3c5fe7f9fbc2bf219b93855107518e7e7fb90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fefd882cdc78455e5b3e880a0f9192b11328b47b77fc4765f3ec74ab433d63a01095ed77e3f82627766a491bc8897c55a07ab25b5fef9012ef866800a8307a120948888f1f195afa192cfee860698584c030f4c9db18203e9840c55699c1ba091fc4c402ced19b984e953546d3fc786c46a79c9f0c7918b8f3343dc529ef0e5a0546d89230c90ca8bf7988a826430d4771ab3a67cc0f3cb8019d67ab10ec10524f861010a82c3509400000000000000000000000000000000000000008203e8801ba0b03ab16ed211bf447ac030216ab088f18367ee51303545d2957990e9d3a28f10a07f18dd055139f7ac5558997b80ccae799ab6fbad2326799db509a9d4e5a52d72f861020a82c3509400000000000000000000000000000000000000008203ea801ba00925abd1221d388622138f4bae46803313f297001e96fec22dc4268fca5b5a82a055cd8142bcec39f80b359aa089f6a70568d23a67048026703981fad9339ef5d4c0",
"transactions" : [
{
"data" : "0x0c55699c",
"gasLimit" : "0x07a120",
"gasPrice" : "0x0a",
"nonce" : "0x00",
"r" : "0x91fc4c402ced19b984e953546d3fc786c46a79c9f0c7918b8f3343dc529ef0e5",
"s" : "0x546d89230c90ca8bf7988a826430d4771ab3a67cc0f3cb8019d67ab10ec10524",
"to" : "8888f1f195afa192cfee860698584c030f4c9db1",
"v" : "0x1b",
"value" : "0x03e9"
},
{
"data" : "0x",
"gasLimit" : "0xc350",
"gasPrice" : "0x0a",
"nonce" : "0x01",
"r" : "0xb03ab16ed211bf447ac030216ab088f18367ee51303545d2957990e9d3a28f10",
"s" : "0x7f18dd055139f7ac5558997b80ccae799ab6fbad2326799db509a9d4e5a52d72",
"to" : "0000000000000000000000000000000000000000",
"v" : "0x1b",
"value" : "0x03e8"
},
{
"data" : "0x",
"gasLimit" : "0xc350",
"gasPrice" : "0x0a",
"nonce" : "0x02",
"r" : "0x0925abd1221d388622138f4bae46803313f297001e96fec22dc4268fca5b5a82",
"s" : "0x55cd8142bcec39f80b359aa089f6a70568d23a67048026703981fad9339ef5d4",
"to" : "0000000000000000000000000000000000000000",
"v" : "0x1b",
"value" : "0x03ea"
}
],
"uncleHeaders" : [
]
}
],
"genesisBlockHeader" : {
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1",
"difficulty" : "0x020000",
"extraData" : "0x42",
"gasLimit" : "0x2fefd8",
"gasUsed" : "0x00",
"hash" : "363315d12ad724ec43a5400affb35e66e0b94bc40c6150b2870f76563a7703a7",
"mixHash" : "d45a667aa8d50bd136d83b1b86bf38fe3cabfb78c47022e67bb6cfcb76529f7b",
"nonce" : "5350f90a8c5a106a",
"number" : "0x00",
"parentHash" : "0000000000000000000000000000000000000000000000000000000000000000",
"receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"stateRoot" : "4941fba20142b10d43d0a893dfa4f5eedcbcb4b55c8554efd71e226624d9b37c",
"timestamp" : "0x54c98c81",
"transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
},
"genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a04941fba20142b10d43d0a893dfa4f5eedcbcb4b55c8554efd71e226624d9b37ca056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a0d45a667aa8d50bd136d83b1b86bf38fe3cabfb78c47022e67bb6cfcb76529f7b885350f90a8c5a106ac0c0",
"lastblockhash" : "b1ff798f6f2a8c617f75b265e00ec67fab2f1e6076359d3332d99e8f69688850",
"postState" : {
"0000000000000000000000000000000000000000" : {
"balance" : "0x07d2",
"code" : "0x",
"nonce" : "0x00",
"storage" : {
}
},
"8888f1f195afa192cfee860698584c030f4c9db1" : {
"balance" : "0x4563918244fa68a0",
"code" : "0x",
"nonce" : "0x00",
"storage" : {
}
},
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
"balance" : "0x025403d650",
"code" : "0x",
"nonce" : "0x03",
"storage" : {
}
}
},
"pre" : {
"8888f1f195afa192cfee860698584c030f4c9db1" : {
"balance" : "0x03e8",
"code" : "0x60606040526000357c0100000000000000000000000000000000000000000000000000000000900480630c55699c146037576035565b005b60406004506042565b005b3373ffffffffffffffffffffffffffffffffffffffff16ff5b56",
"nonce" : "0x00",
"storage" : {
}
},
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
"balance" : "0x02540be400",
"code" : "0x",
"nonce" : "0x00",
"storage" : {
}
}
}
},
"OOGStateCopyContainingDeletedContract" : {
"blocks" : [
{
"blockHeader" : {
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1",
"difficulty" : "0x020000",
"extraData" : "0x",
"gasLimit" : "0x092a08",
"gasUsed" : "0x021ed0",
"hash" : "e6289f0826f8b8998cf5cb3747b95f8e3252a11e5eb930f139bf591b38b3f272",
"mixHash" : "d1fbf3b3e6c0189e04fa100c3d2e78889ffbec16553d50153b3f400fcd2b0589",
"nonce" : "9f2f26d826716c43",
"number" : "0x01",
"parentHash" : "d8eb76ceb37b640d4e0aae5ea85dca3989fe3b2616d2a7b333379c8a315e4fe1",
"receiptTrie" : "3e21fb330e6981a4657f97fc2ace223c75f17d83f0fa017586d5b872b48b4824",
"stateRoot" : "042cf0272a105f572ee8a5a3014aef7fff760fc3ce18c2aedac0cc55c152a4b9",
"timestamp" : "0x55edb8c0",
"transactionsTrie" : "5c3eb7e26c39308ede0b5a0b9b403fb89c3369deda106c32faf7d0def6f421d2",
"uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
},
"rlp" : "0xf902eef901faa0d8eb76ceb37b640d4e0aae5ea85dca3989fe3b2616d2a7b333379c8a315e4fe1a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0042cf0272a105f572ee8a5a3014aef7fff760fc3ce18c2aedac0cc55c152a4b9a05c3eb7e26c39308ede0b5a0b9b403fb89c3369deda106c32faf7d0def6f421d2a03e21fb330e6981a4657f97fc2ace223c75f17d83f0fa017586d5b872b48b4824b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000830200000183092a0883021ed08455edb8c080a0d1fbf3b3e6c0189e04fa100c3d2e78889ffbec16553d50153b3f400fcd2b0589889f2f26d826716c43f8eef864800a830493e09464306ec3f51a26dcf19f5da0c043040f54f4eca501840c5feb5d1ba00cf2cc4de3013273d0aae3cf36cdb6cf152573f7a5b99fe2c514a845bbb98a93a048f4aa20b37303bf4f2c0e7e5f6c178814f99ab4d3d98cf9382185f1ae256b7ff886010a830493e0942e0de3fc10a88911ff857126db1a5f0da6f251738203eaa4fc49c80e00000000000000000000000064306ec3f51a26dcf19f5da0c043040f54f4eca51ca0c9f11f1b4aedd9c1d99a6e2aea6f9ce90bdd6bb6063193715fdb43e77029346fa03440044e3aa54293e887f1751146bf915e73c39eae7da82b75a6d2c7a31d252bc0",
"transactions" : [
{
"data" : "0x0c5feb5d",
"gasLimit" : "0x0493e0",
"gasPrice" : "0x0a",
"nonce" : "0x00",
"r" : "0x0cf2cc4de3013273d0aae3cf36cdb6cf152573f7a5b99fe2c514a845bbb98a93",
"s" : "0x48f4aa20b37303bf4f2c0e7e5f6c178814f99ab4d3d98cf9382185f1ae256b7f",
"to" : "64306ec3f51a26dcf19f5da0c043040f54f4eca5",
"v" : "0x1b",
"value" : "0x01"
},
{
"data" : "0xfc49c80e00000000000000000000000064306ec3f51a26dcf19f5da0c043040f54f4eca5",
"gasLimit" : "0x0493e0",
"gasPrice" : "0x0a",
"nonce" : "0x01",
"r" : "0xc9f11f1b4aedd9c1d99a6e2aea6f9ce90bdd6bb6063193715fdb43e77029346f",
"s" : "0x3440044e3aa54293e887f1751146bf915e73c39eae7da82b75a6d2c7a31d252b",
"to" : "2e0de3fc10a88911ff857126db1a5f0da6f25173",
"v" : "0x1c",
"value" : "0x03ea"
}
],
"uncleHeaders" : [
]
}
],
"genesisBlockHeader" : {
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1",
"difficulty" : "0x020000",
"extraData" : "0x42",
"gasLimit" : "0x0927c0",
"gasUsed" : "0x00",
"hash" : "d8eb76ceb37b640d4e0aae5ea85dca3989fe3b2616d2a7b333379c8a315e4fe1",
"mixHash" : "c29e85e09cf8a71fbf0151f492eb89d135ed3515a6d7bf792978eab16c55e87c",
"nonce" : "02427e36fe1c0e09",
"number" : "0x00",
"parentHash" : "0000000000000000000000000000000000000000000000000000000000000000",
"receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"stateRoot" : "2b9f478fe39744a8c17eb48ae7bf86f6a47031a823a632f9bd661b59978aeefd",
"timestamp" : "0x54c98c81",
"transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
},
"genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a02b9f478fe39744a8c17eb48ae7bf86f6a47031a823a632f9bd661b59978aeefda056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080830927c0808454c98c8142a0c29e85e09cf8a71fbf0151f492eb89d135ed3515a6d7bf792978eab16c55e87c8802427e36fe1c0e09c0c0",
"lastblockhash" : "e6289f0826f8b8998cf5cb3747b95f8e3252a11e5eb930f139bf591b38b3f272",
"postState" : {
"2e0de3fc10a88911ff857126db1a5f0da6f25173" : {
"balance" : "0x03eb",
"code" : "0x60606040526000357c01000000000000000000000000000000000000000000000000000000009004806342e90c3314610044578063fc49c80e1461005157610042565b005b61004f600450610064565b005b6100626004803590602001506100a4565b005b6000600090505b600a8160ff1610156100a057602a600060005082600a81101561000257909001600050819055505b808060010191505061006b565b5b50565b3073ffffffffffffffffffffffffffffffffffffffff1661ea6060405180807f53746f7265282900000000000000000000000000000000000000000000000000815260200150600701905060405180910390207c0100000000000000000000000000000000000000000000000000000000809104027c0100000000000000000000000000000000000000000000000000000000900490604051827c010000000000000000000000000000000000000000000000000000000002815260040180905060006040518083038160008887f19350505050508073ffffffffffffffffffffffffffffffffffffffff166326c6a34c604051817c01000000000000000000000000000000000000000000000000000000000281526004018090506020604051808303816000876161da5a03f115610002575050506040515160006000506009600a81101561000257909001600050819055505b5056",
"nonce" : "0x00",
"storage" : {
"0x09" : "0x26c6a34c00000000000000000000000000000000000000000000000000000000"
}
},
"64306ec3f51a26dcf19f5da0c043040f54f4eca5" : {
"balance" : "0x00",
"code" : "0x",
"nonce" : "0x00",
"storage" : {
}
},
"8888f1f195afa192cfee860698584c030f4c9db1" : {
"balance" : "0x4563918245093420",
"code" : "0x",
"nonce" : "0x00",
"storage" : {
}
},
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
"balance" : "0x174861aff7",
"code" : "0x",
"nonce" : "0x02",
"storage" : {
}
}
},
"pre" : {
"2e0de3fc10a88911ff857126db1a5f0da6f25173" : {
"balance" : "0x01",
"code" : "0x60606040526000357c01000000000000000000000000000000000000000000000000000000009004806342e90c3314610044578063fc49c80e1461005157610042565b005b61004f600450610064565b005b6100626004803590602001506100a4565b005b6000600090505b600a8160ff1610156100a057602a600060005082600a81101561000257909001600050819055505b808060010191505061006b565b5b50565b3073ffffffffffffffffffffffffffffffffffffffff1661ea6060405180807f53746f7265282900000000000000000000000000000000000000000000000000815260200150600701905060405180910390207c0100000000000000000000000000000000000000000000000000000000809104027c0100000000000000000000000000000000000000000000000000000000900490604051827c010000000000000000000000000000000000000000000000000000000002815260040180905060006040518083038160008887f19350505050508073ffffffffffffffffffffffffffffffffffffffff166326c6a34c604051817c01000000000000000000000000000000000000000000000000000000000281526004018090506020604051808303816000876161da5a03f115610002575050506040515160006000506009600a81101561000257909001600050819055505b5056",
"nonce" : "0x00",
"storage" : {
}
},
"64306ec3f51a26dcf19f5da0c043040f54f4eca5" : {
"balance" : "0x01",
"code" : "0x60606040526000357c0100000000000000000000000000000000000000000000000000000000900480630c5feb5d14604157806326c6a34c14604c57603f565b005b604a600450606b565b005b60556004506086565b6040518082815260200191505060405180910390f35b3373ffffffffffffffffffffffffffffffffffffffff16ff5b565b600061053990506091565b9056",
"nonce" : "0x00",
"storage" : {
}
},
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
"balance" : "0x174876e800",
"code" : "0x",
"nonce" : "0x00",
"storage" : {
}
}
}
},
"SimpleTx" : {
"blocks" : [
{
@ -1848,4 +2094,4 @@
}
}
}
}
}

File diff suppressed because it is too large Load Diff

@ -4845,6 +4845,41 @@
}
}
},
"sstore_underflow" : {
"env" : {
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
"currentDifficulty" : "0x0100",
"currentGasLimit" : "0x0f4240",
"currentNumber" : "0x00",
"currentTimestamp" : "0x01"
},
"exec" : {
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"code" : "0x600155",
"data" : "0x",
"gas" : "0x0186a0",
"gasPrice" : "0x5af3107a4000",
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"value" : "0x0de0b6b3a7640000"
},
"expect" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"storage" : {
"0x01" : "0x00"
}
}
},
"pre" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "0x152d02c7e14af6800000",
"code" : "0x600155",
"nonce" : "0x00",
"storage" : {
}
}
}
},
"stack_loop" : {
"callcreates" : [
],

@ -181,9 +181,6 @@ func runStateTest(test VmTest) error {
// check post state
for addr, account := range test.Post {
obj := statedb.GetStateObject(common.HexToAddress(addr))
if obj == nil {
continue
}
if obj.Balance().Cmp(common.Big(account.Balance)) != 0 {
return fmt.Errorf("(%x) balance failed. Expected %v, got %v => %v\n", obj.Address().Bytes()[:4], account.Balance, obj.Balance(), new(big.Int).Sub(common.Big(account.Balance), obj.Balance()))