Browse Source

fix StateLoader

cl-refactor
CJentzsch 10 years ago
parent
commit
a6c3391e77
  1. 1
      libtestutils/StateLoader.cpp
  2. 251
      test/libethereum/BlockTestsFiller/bcGasPricerTestFiller.json
  3. 0
      test/libethereum/BlockTestsFiller/bcRPC_API_TestFiller.json
  4. 9
      test/libethereum/blockchain.cpp

1
libtestutils/StateLoader.cpp

@ -54,5 +54,4 @@ StateLoader::StateLoader(Json::Value const& _json, std::string const& _dbPath):
} }
m_state.commit(); m_state.commit();
m_state.db().commit();
} }

251
test/libethereum/BlockTestsFiller/bcGasPricerTestFiller.json

@ -0,0 +1,251 @@
{
"highGasUsage" : {
"genesisBlockHeader" : {
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1",
"difficulty" : "131072",
"extraData" : "0x42",
"gasLimit" : "3141592",
"gasUsed" : "0",
"mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"nonce" : "0x0102030405060708",
"number" : "0",
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
"receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a",
"timestamp" : "0x54c98c81",
"transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
},
"expect" : {
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
"balance" : "10000000000"
}
},
"pre" : {
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
"balance" : "10000000000",
"nonce" : "0",
"code" : "",
"storage": {}
},
"aaaf5374fce5edbc8e2a8697c15331677e6ebf0b" : {
"balance" : "10000000000",
"nonce" : "0",
"code" : "0x60003551",
"storage": {}
}
},
"blocks" : [
{
"transactions" : [
{
"data" : "0xffffffffffffffffffffffff",
"gasLimit" : "85000",
"gasPrice" : "0",
"nonce" : "0",
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
"value" : "10"
}
],
"uncleHeaders" : [
]
},
{
"transactions" : [
{
"data" : "0xffffffffffff",
"gasLimit" : "85000",
"gasPrice" : "0",
"nonce" : "0",
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
"value" : "10"
}
],
"uncleHeaders" : [
]
}
]
},
"notxs" : {
"genesisBlockHeader" : {
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1",
"difficulty" : "131072",
"extraData" : "0x42",
"gasLimit" : "3141592",
"gasUsed" : "0",
"mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"nonce" : "0x0102030405060708",
"number" : "0",
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
"receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a",
"timestamp" : "0x54c98c81",
"transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
},
"expect" : {
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
"balance" : "10000000000"
}
},
"pre" : {
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
"balance" : "10000000000",
"nonce" : "0",
"code" : "",
"storage": {}
}
},
"blocks" : [
{
"transactions" : [
],
"uncleHeaders" : [
]
},
{
"transactions" : [
],
"uncleHeaders" : [
]
},
{
"transactions" : [
],
"uncleHeaders" : [
]
},
{
"transactions" : [
],
"uncleHeaders" : [
]
},
{
"transactions" : [
],
"uncleHeaders" : [
]
},
{
"transactions" : [
],
"uncleHeaders" : [
]
},
{
"transactions" : [
],
"uncleHeaders" : [
]
},
{
"transactions" : [
],
"uncleHeaders" : [
]
},
{
"transactions" : [
],
"uncleHeaders" : [
]
},
{
"transactions" : [
],
"uncleHeaders" : [
]
},
{
"transactions" : [
],
"uncleHeaders" : [
]
},
{
"transactions" : [
],
"uncleHeaders" : [
]
},
{
"transactions" : [
],
"uncleHeaders" : [
]
},
{
"transactions" : [
],
"uncleHeaders" : [
]
},
{
"transactions" : [
],
"uncleHeaders" : [
]
},
{
"transactions" : [
],
"uncleHeaders" : [
]
},
{
"transactions" : [
],
"uncleHeaders" : [
]
},
{
"transactions" : [
],
"uncleHeaders" : [
]
},
{
"transactions" : [
],
"uncleHeaders" : [
]
},
{
"transactions" : [
],
"uncleHeaders" : [
]
},
{
"transactions" : [
],
"uncleHeaders" : [
]
},
{
"transactions" : [
],
"uncleHeaders" : [
]
},
{
"transactions" : [
],
"uncleHeaders" : [
]
},
{
"transactions" : [
],
"uncleHeaders" : [
]
}
]
}
}

0
test/bcRPC_API_TestFiller.json → test/libethereum/BlockTestsFiller/bcRPC_API_TestFiller.json

9
test/libethereum/blockchain.cpp

@ -54,8 +54,8 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin)
ImportTest importer(o["pre"].get_obj()); ImportTest importer(o["pre"].get_obj());
TransientDirectory td_stateDB; TransientDirectory td_stateDB;
TransientDirectory td_stateDB_tmp; TransientDirectory td_stateDB_tmp;
State state(OverlayDB(State::openDB(td_stateDB.path())), BaseState::Empty, biGenesisBlock.coinbaseAddress); State state(State::openDB(td_stateDB.path()), BaseState::Empty, biGenesisBlock.coinbaseAddress);
State stateTemp(OverlayDB(State::openDB(td_stateDB_tmp.path())), BaseState::Empty, biGenesisBlock.coinbaseAddress); State stateTemp(State::openDB(td_stateDB_tmp.path()), BaseState::Empty, biGenesisBlock.coinbaseAddress);
importer.importState(o["pre"].get_obj(), state); importer.importState(o["pre"].get_obj(), state);
o["pre"] = fillJsonWithState(state); o["pre"] = fillJsonWithState(state);
state.commit(); state.commit();
@ -691,6 +691,11 @@ BOOST_AUTO_TEST_CASE(bcUncleHeaderValiditiy)
dev::test::executeTests("bcUncleHeaderValiditiy", "/BlockTests",dev::test::getFolder(__FILE__) + "/BlockTestsFiller", dev::test::doBlockchainTests); dev::test::executeTests("bcUncleHeaderValiditiy", "/BlockTests",dev::test::getFolder(__FILE__) + "/BlockTestsFiller", dev::test::doBlockchainTests);
} }
BOOST_AUTO_TEST_CASE(bcGasPricerTest)
{
dev::test::executeTests("bcGasPricerTest", "/BlockTests",dev::test::getFolder(__FILE__) + "/BlockTestsFiller", dev::test::doBlockchainTests);
}
BOOST_AUTO_TEST_CASE(userDefinedFile) BOOST_AUTO_TEST_CASE(userDefinedFile)
{ {
dev::test::userDefinedTest("--singletest", dev::test::doBlockchainTests); dev::test::userDefinedTest("--singletest", dev::test::doBlockchainTests);

Loading…
Cancel
Save