diff --git a/libethashseal/Ethash.h b/libethashseal/Ethash.h index a117b0f1030..37fb632fd3c 100644 --- a/libethashseal/Ethash.h +++ b/libethashseal/Ethash.h @@ -66,7 +66,6 @@ class Ethash: public SealEngineBase eth::GenericFarm& farm() { return m_farm; } - enum { MixHashField = 0, NonceField = 1 }; static h256 seedHash(BlockHeader const& _bi); static Nonce nonce(BlockHeader const& _bi) { return _bi.seal(NonceField); } static h256 mixHash(BlockHeader const& _bi) { return _bi.seal(MixHashField); } diff --git a/libethcore/BasicAuthority.cpp b/libethcore/BasicAuthority.cpp index 2d18a90b66d..2551cdf37f8 100644 --- a/libethcore/BasicAuthority.cpp +++ b/libethcore/BasicAuthority.cpp @@ -50,8 +50,11 @@ void BasicAuthority::generateSeal(BlockHeader const& _bi) BlockHeader bi = _bi; h256 h = bi.hash(WithoutSeal); Signature s = sign(m_secret, h); - setSig(bi, s); - SealEngineBase::generateSeal(bi); + setSig(bi, s); + RLPStream ret; + bi.streamRLP(ret); + if (m_onSealGenerated) + m_onSealGenerated(ret.out()); } bool BasicAuthority::onOptionChanging(std::string const& _name, bytes const& _value) diff --git a/libethcore/SealEngine.cpp b/libethcore/SealEngine.cpp index 3ee0d942f98..7a673d00ab5 100644 --- a/libethcore/SealEngine.cpp +++ b/libethcore/SealEngine.cpp @@ -29,6 +29,17 @@ void NoProof::init() ETH_REGISTER_SEAL_ENGINE(NoProof); } +void NoProof::generateSeal(BlockHeader const& _bi) +{ + BlockHeader header(_bi); + header.setSeal(NonceField, h64{0}); + header.setSeal(MixHashField, h256{0}); + RLPStream ret; + header.streamRLP(ret); + if (m_onSealGenerated) + m_onSealGenerated(ret.out()); +} + void SealEngineFace::verify(Strictness _s, BlockHeader const& _bi, BlockHeader const& _parent, bytesConstRef _block) const { _bi.verify(_s, _parent, _block); diff --git a/libethcore/SealEngine.h b/libethcore/SealEngine.h index e15d7b3f2b5..262dbb46e17 100644 --- a/libethcore/SealEngine.h +++ b/libethcore/SealEngine.h @@ -97,14 +97,12 @@ class SealEngineFace class SealEngineBase: public SealEngineFace { public: - void generateSeal(BlockHeader const& _bi) override - { - RLPStream ret; - _bi.streamRLP(ret); - if (m_onSealGenerated) - m_onSealGenerated(ret.out()); - } - void onSealGenerated(std::function const& _f) override { m_onSealGenerated = _f; } + enum + { + MixHashField = 0, + NonceField = 1 + }; + void onSealGenerated(std::function const& _f) override { m_onSealGenerated = _f; } EVMSchedule const& evmSchedule(u256 const& _blockNumber) const override; u256 blockReward(u256 const& _blockNumber) const override; @@ -139,6 +137,7 @@ class NoProof: public eth::SealEngineBase public: static std::string name() { return "NoProof"; } static void init(); + void generateSeal(BlockHeader const& _bi) override; }; } diff --git a/test/tools/jsontests/BlockChainTests.cpp b/test/tools/jsontests/BlockChainTests.cpp index 1acb92ea1ae..3b7f7dc49b5 100644 --- a/test/tools/jsontests/BlockChainTests.cpp +++ b/test/tools/jsontests/BlockChainTests.cpp @@ -109,7 +109,7 @@ json_spirit::mValue BlockchainTestSuite::doTests(json_spirit::mValue const& _inp set netlist; json_spirit::mObject const& expectObj = expect.get_obj(); ImportTest::parseJsonStrValueIntoSet(expectObj.at("network"), netlist); - + netlist = test::translateNetworks(netlist); if (netlist.count(test::netIdToString(network)) || netlist.count("ALL")) { jObjOutput["expect"] = expectObj.at("result"); @@ -440,10 +440,6 @@ void testBCTest(json_spirit::mObject const& _o) TestBlock genesisBlock(_o.at("genesisBlockHeader").get_obj(), _o.at("pre").get_obj()); TestBlockChain::MiningType const miningType = getMiningType(_o); - eth::IncludeSeal includeSeal = (miningType == TestBlockChain::MiningType::ForceEthash || - miningType == TestBlockChain::MiningType::Default) ? - WithSeal : - WithoutSeal; TestBlockChain blockchain(genesisBlock, miningType); TestBlockChain testChain(genesisBlock, miningType); assert(testChain.getInterface().isKnown(genesisBlock.blockHeader().hash(WithSeal))); @@ -539,8 +535,7 @@ void testBCTest(json_spirit::mObject const& _o) } //Check that imported block to the chain is equal to declared block from test - bytes importedblock = - testChain.getInterface().block(blockFromFields.blockHeader().hash(includeSeal)); + bytes importedblock = testChain.getInterface().block(blockFromFields.blockHeader().hash()); TestBlock inchainBlock(toHex(importedblock)); checkBlocks(inchainBlock, blockFromFields, testName); @@ -571,7 +566,7 @@ void testBCTest(json_spirit::mObject const& _o) //Check lastblock hash BOOST_REQUIRE((_o.count("lastblockhash") > 0)); - string lastTrueBlockHash = toHexPrefixed(testChain.topBlock().blockHeader().hash(includeSeal)); + string lastTrueBlockHash = toHexPrefixed(testChain.topBlock().blockHeader().hash()); BOOST_CHECK_MESSAGE(lastTrueBlockHash == _o.at("lastblockhash").get_str(), testName + "Boost check: lastblockhash does not match " + lastTrueBlockHash + " expected: " + _o.at("lastblockhash").get_str()); @@ -1100,7 +1095,6 @@ BOOST_AUTO_TEST_CASE(stBugs){} //Constantinople Tests BOOST_AUTO_TEST_CASE(stShift){} - //Stress Tests BOOST_AUTO_TEST_CASE(stAttackTest){} BOOST_AUTO_TEST_CASE(stMemoryStressTest){} diff --git a/test/tools/jsontests/StateTests.cpp b/test/tools/jsontests/StateTests.cpp index a01946ee4d5..65d985574a6 100644 --- a/test/tools/jsontests/StateTests.cpp +++ b/test/tools/jsontests/StateTests.cpp @@ -112,8 +112,12 @@ json_spirit::mValue StateTestSuite::doTests(json_spirit::mValue const& _input, b if (!foundResults) { Options const& opt = Options::get(); - BOOST_ERROR("Transaction not found! (Network: " + (opt.singleTestNet.empty() ? "Any" : opt.singleTestNet) + ", dataInd: " + toString(opt.trDataIndex) + ", gasInd: " + toString(opt.trGasIndex) + ", valInd: " + toString(opt.trValueIndex) + ")"); - } + BOOST_ERROR("Transaction not found! (Test: '" + testname + "', Network: " + + (opt.singleTestNet.empty() ? "Any" : opt.singleTestNet) + + ", dataInd: " + toString(opt.trDataIndex) + + ", gasInd: " + toString(opt.trGasIndex) + + ", valInd: " + toString(opt.trValueIndex) + ")"); + } if (Options::get().statediff) importer.traceStateDiff(); diff --git a/test/unittests/libethereum/BlockChainInsert.cpp b/test/unittests/libethereum/BlockChainInsert.cpp index e046f076394..fdec08c27b3 100644 --- a/test/unittests/libethereum/BlockChainInsert.cpp +++ b/test/unittests/libethereum/BlockChainInsert.cpp @@ -152,8 +152,6 @@ void syncStateTrie(bytesConstRef _block, OverlayDB const& _dbSource, OverlayDB& BOOST_AUTO_TEST_CASE(bcBasicInsert) { BasicAuthority::init(); - BasicAuthority::init(); - KeyPair me = Secret(sha3("Gav Wood")); KeyPair myMiner = Secret(sha3("Gav's Miner"));