Skip to content
This repository has been archived by the owner on Oct 28, 2021. It is now read-only.

Commit

Permalink
Fix tests after that relied on the medstate in receipts
Browse files Browse the repository at this point in the history
  • Loading branch information
gumb0 committed Apr 27, 2017
1 parent 1ce0eb6 commit d01152a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
5 changes: 3 additions & 2 deletions test/tools/libtesteth/BlockChainHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -501,8 +501,9 @@ bool TestBlockChain::addBlock(TestBlock const& _block)
Block block = (m_blockChain.get()->genesisBlock(genesisDB));
block.sync(*m_blockChain.get());

//BOOST_REQUIRE(m_lastBlock.blockHeader().hash() == BlockHeader(block.blockData()).hash());
m_lastBlock.setState(/*block.fromPending(10000)*/block.state());
State st(block.state());
st.setRoot(block.info().stateRoot());
m_lastBlock.setState(st);
return true;
}

Expand Down
19 changes: 9 additions & 10 deletions test/unittests/libethereum/Block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ BOOST_AUTO_TEST_CASE(bStates)
OverlayDB const& genesisDB = genesisBlock.state().db();
BlockChain const& blockchain = testBlockchain.interface();

State stateBofore = testBlockchain.topBlock().state();
h256 stateBefore = testBlockchain.topBlock().state().rootHash();

TestBlock testBlock;
TestTransaction transaction1 = TestTransaction::defaultTransaction(1);
Expand All @@ -76,17 +76,16 @@ BOOST_AUTO_TEST_CASE(bStates)

Block block2 = blockchain.genesisBlock(genesisDB);
block2.populateFromChain(blockchain, testBlock.blockHeader().hash());
/* State stateAfterInsert = block2.fromPending(0); //get the state of blockchain on previous block
BOOST_REQUIRE(ImportTest::compareStates(stateBofore, stateAfterInsert) == 0);
h256 stateAfterInsert = block2.stateRootBeforeTx(0); //get the state of blockchain on previous block
BOOST_REQUIRE_EQUAL(stateBefore, stateAfterInsert);

// TODO remove this
State stateAfterInsert1 = block2.fromPending(1); //get the state of blockchain on current block executed
BOOST_REQUIRE(ImportTest::compareStates(stateAfterInsert, stateAfterInsert1, eth::AccountMaskMap(), WhenError::DontThrow) == 1);
h256 stateAfterInsert1 = block2.stateRootBeforeTx(1); //get the state of blockchain on current block executed
BOOST_REQUIRE(stateAfterInsert != stateAfterInsert1);

h256 stateAfterInsert2 = block2.stateRootBeforeTx(2); //get the state of blockchain on current block executed
BOOST_REQUIRE(stateBefore != stateAfterInsert2);
BOOST_REQUIRE(stateAfterInsert1 != stateAfterInsert2);

State stateAfterInsert2 = block2.fromPending(2); //get the state of blockchain on current block executed
BOOST_REQUIRE(ImportTest::compareStates(stateBofore, stateAfterInsert2, eth::AccountMaskMap(), WhenError::DontThrow) == 1);
BOOST_REQUIRE(ImportTest::compareStates(stateAfterInsert1, stateAfterInsert2, eth::AccountMaskMap(), WhenError::DontThrow) == 1);
*/
//Block2 will start a new block on top of blockchain
BOOST_REQUIRE(block1.info() == block2.info());
block2.sync(blockchain);
Expand Down

0 comments on commit d01152a

Please sign in to comment.