From 5746674ffd8e0a9d9dcd34e68eb5a8c00b837570 Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Wed, 24 Jun 2015 23:07:05 +0200 Subject: [PATCH 01/38] blockchain isKnown block / transaction From d8d968a680bd2d6fa04989c38c079dc8bf21c737 Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Wed, 24 Jun 2015 23:25:13 +0200 Subject: [PATCH 02/38] getBlockBy** and getBlockTransactionCountBy** return null if block is not found From e2f1d13678fb876f0c584ee87d4a9f9ec80cc9f2 Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Wed, 15 Jul 2015 17:18:34 +0200 Subject: [PATCH 03/38] getLogsEx && propert order of returned Ex logs From 7b6cd4e13fbd00365f91fcc85e2be77046280f8f Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Mon, 6 Jul 2015 18:59:19 -0700 Subject: [PATCH 04/38] Modularise nonce, mix hash and seed hash. --- TestHelper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TestHelper.cpp b/TestHelper.cpp index f49ed1e09..b43c4db51 100644 --- a/TestHelper.cpp +++ b/TestHelper.cpp @@ -81,7 +81,7 @@ void mine(BlockInfo& _bi) bool completed = false; f.onSolutionFound([&](ProofOfWork::Solution sol) { - ProofOfWork::assignResult(sol, _bi); + _bi.proof = sol; return completed = true; }); f.setWork(_bi); From 2cdbf807ca2ba5e1a5166cc784a19839a84f873e Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Wed, 15 Jul 2015 23:24:10 +0200 Subject: [PATCH 05/38] Basic test working with same code for Ethash and BasicAuthority. From 6f94b767ae36364e5fa4c347c450c2f52a579ee3 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Thu, 16 Jul 2015 01:29:03 +0200 Subject: [PATCH 06/38] All fields of BlockInfo now private. --- TestHelper.cpp | 6 +++--- libsolidity/SolidityEndToEndTest.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/TestHelper.cpp b/TestHelper.cpp index b43c4db51..bae980a7e 100644 --- a/TestHelper.cpp +++ b/TestHelper.cpp @@ -151,12 +151,12 @@ void ImportTest::importEnv(json_spirit::mObject& _o) assert(_o.count("currentCoinbase") > 0); assert(_o.count("currentNumber") > 0); - m_environment.currentBlock.parentHash = h256(_o["previousHash"].get_str()); + m_environment.currentBlock.parentHash() = h256(_o["previousHash"].get_str()); m_environment.currentBlock.number = toInt(_o["currentNumber"]); m_environment.currentBlock.gasLimit = toInt(_o["currentGasLimit"]); m_environment.currentBlock.difficulty = toInt(_o["currentDifficulty"]); - m_environment.currentBlock.timestamp = toInt(_o["currentTimestamp"]); - m_environment.currentBlock.coinbaseAddress = Address(_o["currentCoinbase"].get_str()); + m_environment.currentBlock.timestamp() = toInt(_o["currentTimestamp"]); + m_environment.currentBlock.coinbaseAddress() = Address(_o["currentCoinbase"].get_str()); m_statePre.m_previousBlock = m_environment.previousBlock; m_statePre.m_currentBlock = m_environment.currentBlock; diff --git a/libsolidity/SolidityEndToEndTest.cpp b/libsolidity/SolidityEndToEndTest.cpp index 9f806347e..be44ea009 100644 --- a/libsolidity/SolidityEndToEndTest.cpp +++ b/libsolidity/SolidityEndToEndTest.cpp @@ -1187,7 +1187,7 @@ BOOST_AUTO_TEST_CASE(now) { char const* sourceCode = "contract test {\n" " function someInfo() returns (bool success) {\n" - " return block.timestamp == now && now > 0;\n" + " return block.timestamp() == now && now > 0;\n" " }\n" "}\n"; compileAndRun(sourceCode); From 772389306d2689dd7f995ca5daad57e5110f96dc Mon Sep 17 00:00:00 2001 From: arkpar Date: Thu, 16 Jul 2015 18:11:08 +0200 Subject: [PATCH 07/38] started tests refactoring --- TestHelper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TestHelper.cpp b/TestHelper.cpp index bae980a7e..30f323369 100644 --- a/TestHelper.cpp +++ b/TestHelper.cpp @@ -63,7 +63,7 @@ void connectClients(Client& c1, Client& c2) void mine(State& s, BlockChain const& _bc) { s.commitToMine(_bc); - GenericFarm f; + GenericFarm f; bool completed = false; f.onSolutionFound([&](ProofOfWork::Solution sol) { From 699678139fc804b59ba69e7002df6b67514f4a78 Mon Sep 17 00:00:00 2001 From: arkpar Date: Thu, 16 Jul 2015 20:53:58 +0200 Subject: [PATCH 08/38] eth working --- TestHelper.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/TestHelper.cpp b/TestHelper.cpp index 30f323369..c29788b9f 100644 --- a/TestHelper.cpp +++ b/TestHelper.cpp @@ -23,6 +23,7 @@ #include #include +#include #include #include #include @@ -63,11 +64,17 @@ void connectClients(Client& c1, Client& c2) void mine(State& s, BlockChain const& _bc) { s.commitToMine(_bc); - GenericFarm f; + GenericFarm f; bool completed = false; - f.onSolutionFound([&](ProofOfWork::Solution sol) + Ethash::BlockHeader header(s.info); + f.onSolutionFound([&](EthashProofOfWork::Solution sol) { - return completed = s.completeMine(sol); + header.m_mixHash = sol.mixHash; + header.m_nonce = sol.nonce; + RLPStream ret; + header.streamRLP(ret); + s.sealBlock(ret); + return true; }); f.setWork(s.info()); f.startCPU(); @@ -77,9 +84,9 @@ void mine(State& s, BlockChain const& _bc) void mine(BlockInfo& _bi) { - GenericFarm f; + GenericFarm f; bool completed = false; - f.onSolutionFound([&](ProofOfWork::Solution sol) + f.onSolutionFound([&](EthashProofOfWork::Solution sol) { _bi.proof = sol; return completed = true; From 30205b156bac817704f338003e78ddd5b5047492 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Mon, 6 Jul 2015 18:59:19 -0700 Subject: [PATCH 09/38] Modularise nonce, mix hash and seed hash. --- TestHelper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TestHelper.cpp b/TestHelper.cpp index f49ed1e09..b43c4db51 100644 --- a/TestHelper.cpp +++ b/TestHelper.cpp @@ -81,7 +81,7 @@ void mine(BlockInfo& _bi) bool completed = false; f.onSolutionFound([&](ProofOfWork::Solution sol) { - ProofOfWork::assignResult(sol, _bi); + _bi.proof = sol; return completed = true; }); f.setWork(_bi); From 57f7839049d39f2935ea50079285621dc473b70f Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Wed, 15 Jul 2015 23:24:10 +0200 Subject: [PATCH 10/38] Basic test working with same code for Ethash and BasicAuthority. From 80c55ce87a338cbf852b8c6547fda9cbbf8af2a9 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Thu, 16 Jul 2015 01:29:03 +0200 Subject: [PATCH 11/38] All fields of BlockInfo now private. --- TestHelper.cpp | 6 +++--- libsolidity/SolidityEndToEndTest.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/TestHelper.cpp b/TestHelper.cpp index b43c4db51..bae980a7e 100644 --- a/TestHelper.cpp +++ b/TestHelper.cpp @@ -151,12 +151,12 @@ void ImportTest::importEnv(json_spirit::mObject& _o) assert(_o.count("currentCoinbase") > 0); assert(_o.count("currentNumber") > 0); - m_environment.currentBlock.parentHash = h256(_o["previousHash"].get_str()); + m_environment.currentBlock.parentHash() = h256(_o["previousHash"].get_str()); m_environment.currentBlock.number = toInt(_o["currentNumber"]); m_environment.currentBlock.gasLimit = toInt(_o["currentGasLimit"]); m_environment.currentBlock.difficulty = toInt(_o["currentDifficulty"]); - m_environment.currentBlock.timestamp = toInt(_o["currentTimestamp"]); - m_environment.currentBlock.coinbaseAddress = Address(_o["currentCoinbase"].get_str()); + m_environment.currentBlock.timestamp() = toInt(_o["currentTimestamp"]); + m_environment.currentBlock.coinbaseAddress() = Address(_o["currentCoinbase"].get_str()); m_statePre.m_previousBlock = m_environment.previousBlock; m_statePre.m_currentBlock = m_environment.currentBlock; diff --git a/libsolidity/SolidityEndToEndTest.cpp b/libsolidity/SolidityEndToEndTest.cpp index 9f806347e..be44ea009 100644 --- a/libsolidity/SolidityEndToEndTest.cpp +++ b/libsolidity/SolidityEndToEndTest.cpp @@ -1187,7 +1187,7 @@ BOOST_AUTO_TEST_CASE(now) { char const* sourceCode = "contract test {\n" " function someInfo() returns (bool success) {\n" - " return block.timestamp == now && now > 0;\n" + " return block.timestamp() == now && now > 0;\n" " }\n" "}\n"; compileAndRun(sourceCode); From 6e9542e8371050ce41389d55840fc57cc4ac9ebe Mon Sep 17 00:00:00 2001 From: arkpar Date: Thu, 16 Jul 2015 18:11:08 +0200 Subject: [PATCH 12/38] started tests refactoring --- TestHelper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TestHelper.cpp b/TestHelper.cpp index bae980a7e..30f323369 100644 --- a/TestHelper.cpp +++ b/TestHelper.cpp @@ -63,7 +63,7 @@ void connectClients(Client& c1, Client& c2) void mine(State& s, BlockChain const& _bc) { s.commitToMine(_bc); - GenericFarm f; + GenericFarm f; bool completed = false; f.onSolutionFound([&](ProofOfWork::Solution sol) { From 4e722b9b5975f02dad50f0930e96dfdef0b6547f Mon Sep 17 00:00:00 2001 From: arkpar Date: Thu, 16 Jul 2015 20:53:58 +0200 Subject: [PATCH 13/38] eth working --- TestHelper.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/TestHelper.cpp b/TestHelper.cpp index 30f323369..c29788b9f 100644 --- a/TestHelper.cpp +++ b/TestHelper.cpp @@ -23,6 +23,7 @@ #include #include +#include #include #include #include @@ -63,11 +64,17 @@ void connectClients(Client& c1, Client& c2) void mine(State& s, BlockChain const& _bc) { s.commitToMine(_bc); - GenericFarm f; + GenericFarm f; bool completed = false; - f.onSolutionFound([&](ProofOfWork::Solution sol) + Ethash::BlockHeader header(s.info); + f.onSolutionFound([&](EthashProofOfWork::Solution sol) { - return completed = s.completeMine(sol); + header.m_mixHash = sol.mixHash; + header.m_nonce = sol.nonce; + RLPStream ret; + header.streamRLP(ret); + s.sealBlock(ret); + return true; }); f.setWork(s.info()); f.startCPU(); @@ -77,9 +84,9 @@ void mine(State& s, BlockChain const& _bc) void mine(BlockInfo& _bi) { - GenericFarm f; + GenericFarm f; bool completed = false; - f.onSolutionFound([&](ProofOfWork::Solution sol) + f.onSolutionFound([&](EthashProofOfWork::Solution sol) { _bi.proof = sol; return completed = true; From 8b1c261f317d3ad6598ba982e0ee826b83ecf015 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Mon, 6 Jul 2015 18:59:19 -0700 Subject: [PATCH 14/38] Modularise nonce, mix hash and seed hash. --- TestHelper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TestHelper.cpp b/TestHelper.cpp index f49ed1e09..b43c4db51 100644 --- a/TestHelper.cpp +++ b/TestHelper.cpp @@ -81,7 +81,7 @@ void mine(BlockInfo& _bi) bool completed = false; f.onSolutionFound([&](ProofOfWork::Solution sol) { - ProofOfWork::assignResult(sol, _bi); + _bi.proof = sol; return completed = true; }); f.setWork(_bi); From 3f003c2344b0089af0cdb7e1ff197d95b5e9c356 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Wed, 15 Jul 2015 23:24:10 +0200 Subject: [PATCH 15/38] Basic test working with same code for Ethash and BasicAuthority. From 20be64f5999fc4848cdfc3c3dcce6136c9494a61 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Thu, 16 Jul 2015 01:29:03 +0200 Subject: [PATCH 16/38] All fields of BlockInfo now private. --- TestHelper.cpp | 6 +++--- libsolidity/SolidityEndToEndTest.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/TestHelper.cpp b/TestHelper.cpp index b43c4db51..bae980a7e 100644 --- a/TestHelper.cpp +++ b/TestHelper.cpp @@ -151,12 +151,12 @@ void ImportTest::importEnv(json_spirit::mObject& _o) assert(_o.count("currentCoinbase") > 0); assert(_o.count("currentNumber") > 0); - m_environment.currentBlock.parentHash = h256(_o["previousHash"].get_str()); + m_environment.currentBlock.parentHash() = h256(_o["previousHash"].get_str()); m_environment.currentBlock.number = toInt(_o["currentNumber"]); m_environment.currentBlock.gasLimit = toInt(_o["currentGasLimit"]); m_environment.currentBlock.difficulty = toInt(_o["currentDifficulty"]); - m_environment.currentBlock.timestamp = toInt(_o["currentTimestamp"]); - m_environment.currentBlock.coinbaseAddress = Address(_o["currentCoinbase"].get_str()); + m_environment.currentBlock.timestamp() = toInt(_o["currentTimestamp"]); + m_environment.currentBlock.coinbaseAddress() = Address(_o["currentCoinbase"].get_str()); m_statePre.m_previousBlock = m_environment.previousBlock; m_statePre.m_currentBlock = m_environment.currentBlock; diff --git a/libsolidity/SolidityEndToEndTest.cpp b/libsolidity/SolidityEndToEndTest.cpp index d44545145..4a6507cd6 100644 --- a/libsolidity/SolidityEndToEndTest.cpp +++ b/libsolidity/SolidityEndToEndTest.cpp @@ -1188,7 +1188,7 @@ BOOST_AUTO_TEST_CASE(now) { char const* sourceCode = "contract test {\n" " function someInfo() returns (bool success) {\n" - " return block.timestamp == now && now > 0;\n" + " return block.timestamp() == now && now > 0;\n" " }\n" "}\n"; compileAndRun(sourceCode); From ddaa709f1e09d005e4797624f3deb1adae3b443b Mon Sep 17 00:00:00 2001 From: arkpar Date: Thu, 16 Jul 2015 18:11:08 +0200 Subject: [PATCH 17/38] started tests refactoring --- TestHelper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TestHelper.cpp b/TestHelper.cpp index bae980a7e..30f323369 100644 --- a/TestHelper.cpp +++ b/TestHelper.cpp @@ -63,7 +63,7 @@ void connectClients(Client& c1, Client& c2) void mine(State& s, BlockChain const& _bc) { s.commitToMine(_bc); - GenericFarm f; + GenericFarm f; bool completed = false; f.onSolutionFound([&](ProofOfWork::Solution sol) { From 8ad9d346d92adb59ca8b4046a8fc8d7c87a2cf15 Mon Sep 17 00:00:00 2001 From: arkpar Date: Thu, 16 Jul 2015 20:53:58 +0200 Subject: [PATCH 18/38] eth working --- TestHelper.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/TestHelper.cpp b/TestHelper.cpp index 30f323369..c29788b9f 100644 --- a/TestHelper.cpp +++ b/TestHelper.cpp @@ -23,6 +23,7 @@ #include #include +#include #include #include #include @@ -63,11 +64,17 @@ void connectClients(Client& c1, Client& c2) void mine(State& s, BlockChain const& _bc) { s.commitToMine(_bc); - GenericFarm f; + GenericFarm f; bool completed = false; - f.onSolutionFound([&](ProofOfWork::Solution sol) + Ethash::BlockHeader header(s.info); + f.onSolutionFound([&](EthashProofOfWork::Solution sol) { - return completed = s.completeMine(sol); + header.m_mixHash = sol.mixHash; + header.m_nonce = sol.nonce; + RLPStream ret; + header.streamRLP(ret); + s.sealBlock(ret); + return true; }); f.setWork(s.info()); f.startCPU(); @@ -77,9 +84,9 @@ void mine(State& s, BlockChain const& _bc) void mine(BlockInfo& _bi) { - GenericFarm f; + GenericFarm f; bool completed = false; - f.onSolutionFound([&](ProofOfWork::Solution sol) + f.onSolutionFound([&](EthashProofOfWork::Solution sol) { _bi.proof = sol; return completed = true; From df40fac1df7f90f5a810c8c87d86948956faa07b Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Mon, 6 Jul 2015 18:59:19 -0700 Subject: [PATCH 19/38] Modularise nonce, mix hash and seed hash. --- TestHelper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TestHelper.cpp b/TestHelper.cpp index f49ed1e09..b43c4db51 100644 --- a/TestHelper.cpp +++ b/TestHelper.cpp @@ -81,7 +81,7 @@ void mine(BlockInfo& _bi) bool completed = false; f.onSolutionFound([&](ProofOfWork::Solution sol) { - ProofOfWork::assignResult(sol, _bi); + _bi.proof = sol; return completed = true; }); f.setWork(_bi); From 33392f30fa95b52b9220db127dfdb4ebd13fb1d8 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Wed, 15 Jul 2015 23:24:10 +0200 Subject: [PATCH 20/38] Basic test working with same code for Ethash and BasicAuthority. From dbbe46586a1747f402d0f5917ca731b1e61f936b Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Thu, 16 Jul 2015 01:29:03 +0200 Subject: [PATCH 21/38] All fields of BlockInfo now private. --- TestHelper.cpp | 6 +++--- libsolidity/SolidityEndToEndTest.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/TestHelper.cpp b/TestHelper.cpp index b43c4db51..bae980a7e 100644 --- a/TestHelper.cpp +++ b/TestHelper.cpp @@ -151,12 +151,12 @@ void ImportTest::importEnv(json_spirit::mObject& _o) assert(_o.count("currentCoinbase") > 0); assert(_o.count("currentNumber") > 0); - m_environment.currentBlock.parentHash = h256(_o["previousHash"].get_str()); + m_environment.currentBlock.parentHash() = h256(_o["previousHash"].get_str()); m_environment.currentBlock.number = toInt(_o["currentNumber"]); m_environment.currentBlock.gasLimit = toInt(_o["currentGasLimit"]); m_environment.currentBlock.difficulty = toInt(_o["currentDifficulty"]); - m_environment.currentBlock.timestamp = toInt(_o["currentTimestamp"]); - m_environment.currentBlock.coinbaseAddress = Address(_o["currentCoinbase"].get_str()); + m_environment.currentBlock.timestamp() = toInt(_o["currentTimestamp"]); + m_environment.currentBlock.coinbaseAddress() = Address(_o["currentCoinbase"].get_str()); m_statePre.m_previousBlock = m_environment.previousBlock; m_statePre.m_currentBlock = m_environment.currentBlock; diff --git a/libsolidity/SolidityEndToEndTest.cpp b/libsolidity/SolidityEndToEndTest.cpp index d44545145..4a6507cd6 100644 --- a/libsolidity/SolidityEndToEndTest.cpp +++ b/libsolidity/SolidityEndToEndTest.cpp @@ -1188,7 +1188,7 @@ BOOST_AUTO_TEST_CASE(now) { char const* sourceCode = "contract test {\n" " function someInfo() returns (bool success) {\n" - " return block.timestamp == now && now > 0;\n" + " return block.timestamp() == now && now > 0;\n" " }\n" "}\n"; compileAndRun(sourceCode); From 1f2433bfcb6309ee60db3d868c42a5e13b12472b Mon Sep 17 00:00:00 2001 From: arkpar Date: Thu, 16 Jul 2015 18:11:08 +0200 Subject: [PATCH 22/38] started tests refactoring --- TestHelper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TestHelper.cpp b/TestHelper.cpp index bae980a7e..30f323369 100644 --- a/TestHelper.cpp +++ b/TestHelper.cpp @@ -63,7 +63,7 @@ void connectClients(Client& c1, Client& c2) void mine(State& s, BlockChain const& _bc) { s.commitToMine(_bc); - GenericFarm f; + GenericFarm f; bool completed = false; f.onSolutionFound([&](ProofOfWork::Solution sol) { From 94ea6254a19ef8ffc5513f2fb90a019f2ed8ba33 Mon Sep 17 00:00:00 2001 From: arkpar Date: Thu, 16 Jul 2015 20:53:58 +0200 Subject: [PATCH 23/38] eth working --- TestHelper.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/TestHelper.cpp b/TestHelper.cpp index 30f323369..c29788b9f 100644 --- a/TestHelper.cpp +++ b/TestHelper.cpp @@ -23,6 +23,7 @@ #include #include +#include #include #include #include @@ -63,11 +64,17 @@ void connectClients(Client& c1, Client& c2) void mine(State& s, BlockChain const& _bc) { s.commitToMine(_bc); - GenericFarm f; + GenericFarm f; bool completed = false; - f.onSolutionFound([&](ProofOfWork::Solution sol) + Ethash::BlockHeader header(s.info); + f.onSolutionFound([&](EthashProofOfWork::Solution sol) { - return completed = s.completeMine(sol); + header.m_mixHash = sol.mixHash; + header.m_nonce = sol.nonce; + RLPStream ret; + header.streamRLP(ret); + s.sealBlock(ret); + return true; }); f.setWork(s.info()); f.startCPU(); @@ -77,9 +84,9 @@ void mine(State& s, BlockChain const& _bc) void mine(BlockInfo& _bi) { - GenericFarm f; + GenericFarm f; bool completed = false; - f.onSolutionFound([&](ProofOfWork::Solution sol) + f.onSolutionFound([&](EthashProofOfWork::Solution sol) { _bi.proof = sol; return completed = true; From 19476a6b5f03c4f48ab79e2574abf198e627ac8c Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Mon, 6 Jul 2015 18:59:19 -0700 Subject: [PATCH 24/38] Modularise nonce, mix hash and seed hash. --- TestHelper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TestHelper.cpp b/TestHelper.cpp index f49ed1e09..b43c4db51 100644 --- a/TestHelper.cpp +++ b/TestHelper.cpp @@ -81,7 +81,7 @@ void mine(BlockInfo& _bi) bool completed = false; f.onSolutionFound([&](ProofOfWork::Solution sol) { - ProofOfWork::assignResult(sol, _bi); + _bi.proof = sol; return completed = true; }); f.setWork(_bi); From 6c57e398da834af127eec8e59837b67b51c1db60 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Wed, 15 Jul 2015 23:24:10 +0200 Subject: [PATCH 25/38] Basic test working with same code for Ethash and BasicAuthority. From 27a1f9bfee23e5d5cf75e56a5a4b8c632dd36ff3 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Thu, 16 Jul 2015 01:29:03 +0200 Subject: [PATCH 26/38] All fields of BlockInfo now private. --- TestHelper.cpp | 6 +++--- libsolidity/SolidityEndToEndTest.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/TestHelper.cpp b/TestHelper.cpp index b43c4db51..bae980a7e 100644 --- a/TestHelper.cpp +++ b/TestHelper.cpp @@ -151,12 +151,12 @@ void ImportTest::importEnv(json_spirit::mObject& _o) assert(_o.count("currentCoinbase") > 0); assert(_o.count("currentNumber") > 0); - m_environment.currentBlock.parentHash = h256(_o["previousHash"].get_str()); + m_environment.currentBlock.parentHash() = h256(_o["previousHash"].get_str()); m_environment.currentBlock.number = toInt(_o["currentNumber"]); m_environment.currentBlock.gasLimit = toInt(_o["currentGasLimit"]); m_environment.currentBlock.difficulty = toInt(_o["currentDifficulty"]); - m_environment.currentBlock.timestamp = toInt(_o["currentTimestamp"]); - m_environment.currentBlock.coinbaseAddress = Address(_o["currentCoinbase"].get_str()); + m_environment.currentBlock.timestamp() = toInt(_o["currentTimestamp"]); + m_environment.currentBlock.coinbaseAddress() = Address(_o["currentCoinbase"].get_str()); m_statePre.m_previousBlock = m_environment.previousBlock; m_statePre.m_currentBlock = m_environment.currentBlock; diff --git a/libsolidity/SolidityEndToEndTest.cpp b/libsolidity/SolidityEndToEndTest.cpp index d44545145..4a6507cd6 100644 --- a/libsolidity/SolidityEndToEndTest.cpp +++ b/libsolidity/SolidityEndToEndTest.cpp @@ -1188,7 +1188,7 @@ BOOST_AUTO_TEST_CASE(now) { char const* sourceCode = "contract test {\n" " function someInfo() returns (bool success) {\n" - " return block.timestamp == now && now > 0;\n" + " return block.timestamp() == now && now > 0;\n" " }\n" "}\n"; compileAndRun(sourceCode); From 1554fa8126586d0e594d7a052bec145469b02de8 Mon Sep 17 00:00:00 2001 From: arkpar Date: Thu, 16 Jul 2015 18:11:08 +0200 Subject: [PATCH 27/38] started tests refactoring --- TestHelper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TestHelper.cpp b/TestHelper.cpp index bae980a7e..30f323369 100644 --- a/TestHelper.cpp +++ b/TestHelper.cpp @@ -63,7 +63,7 @@ void connectClients(Client& c1, Client& c2) void mine(State& s, BlockChain const& _bc) { s.commitToMine(_bc); - GenericFarm f; + GenericFarm f; bool completed = false; f.onSolutionFound([&](ProofOfWork::Solution sol) { From 1d0d1d1f344aeb557c77ce4a6ae721ce93bf665b Mon Sep 17 00:00:00 2001 From: arkpar Date: Thu, 16 Jul 2015 20:53:58 +0200 Subject: [PATCH 28/38] eth working --- TestHelper.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/TestHelper.cpp b/TestHelper.cpp index 30f323369..c29788b9f 100644 --- a/TestHelper.cpp +++ b/TestHelper.cpp @@ -23,6 +23,7 @@ #include #include +#include #include #include #include @@ -63,11 +64,17 @@ void connectClients(Client& c1, Client& c2) void mine(State& s, BlockChain const& _bc) { s.commitToMine(_bc); - GenericFarm f; + GenericFarm f; bool completed = false; - f.onSolutionFound([&](ProofOfWork::Solution sol) + Ethash::BlockHeader header(s.info); + f.onSolutionFound([&](EthashProofOfWork::Solution sol) { - return completed = s.completeMine(sol); + header.m_mixHash = sol.mixHash; + header.m_nonce = sol.nonce; + RLPStream ret; + header.streamRLP(ret); + s.sealBlock(ret); + return true; }); f.setWork(s.info()); f.startCPU(); @@ -77,9 +84,9 @@ void mine(State& s, BlockChain const& _bc) void mine(BlockInfo& _bi) { - GenericFarm f; + GenericFarm f; bool completed = false; - f.onSolutionFound([&](ProofOfWork::Solution sol) + f.onSolutionFound([&](EthashProofOfWork::Solution sol) { _bi.proof = sol; return completed = true; From fd893fac610f2b2a0b689f28bbd343c14712fcb5 Mon Sep 17 00:00:00 2001 From: arkpar Date: Sat, 18 Jul 2015 15:19:15 +0200 Subject: [PATCH 29/38] tests repared --- TestHelper.cpp | 101 ++++++++++++++++++++++++++++++++----------------- TestHelper.h | 19 +++++++++- 2 files changed, 84 insertions(+), 36 deletions(-) diff --git a/TestHelper.cpp b/TestHelper.cpp index c29788b9f..aec72285c 100644 --- a/TestHelper.cpp +++ b/TestHelper.cpp @@ -63,38 +63,23 @@ void connectClients(Client& c1, Client& c2) void mine(State& s, BlockChain const& _bc) { + std::unique_ptr sealer(Ethash::createSealEngine()); s.commitToMine(_bc); - GenericFarm f; - bool completed = false; - Ethash::BlockHeader header(s.info); - f.onSolutionFound([&](EthashProofOfWork::Solution sol) - { - header.m_mixHash = sol.mixHash; - header.m_nonce = sol.nonce; - RLPStream ret; - header.streamRLP(ret); - s.sealBlock(ret); - return true; - }); - f.setWork(s.info()); - f.startCPU(); - while (!completed) - this_thread::sleep_for(chrono::milliseconds(20)); + Notified sealed; + sealer->onSealGenerated([&](bytes const& sealedHeader){ sealed = sealedHeader; }); + sealer->generateSeal(s.info()); + sealed.waitNot({}); + s.sealBlock(sealed); } -void mine(BlockInfo& _bi) +void mine(Ethash::BlockHeader& _bi) { - GenericFarm f; - bool completed = false; - f.onSolutionFound([&](EthashProofOfWork::Solution sol) - { - _bi.proof = sol; - return completed = true; - }); - f.setWork(_bi); - f.startCPU(); - while (!completed) - this_thread::sleep_for(chrono::milliseconds(20)); + std::unique_ptr sealer(Ethash::createSealEngine()); + Notified sealed; + sealer->onSealGenerated([&](bytes const& sealedHeader){ sealed = sealedHeader; }); + sealer->generateSeal(_bi); + sealed.waitNot({}); + _bi = Ethash::BlockHeader(sealed); } } @@ -158,13 +143,24 @@ void ImportTest::importEnv(json_spirit::mObject& _o) assert(_o.count("currentCoinbase") > 0); assert(_o.count("currentNumber") > 0); - m_environment.currentBlock.parentHash() = h256(_o["previousHash"].get_str()); - m_environment.currentBlock.number = toInt(_o["currentNumber"]); - m_environment.currentBlock.gasLimit = toInt(_o["currentGasLimit"]); - m_environment.currentBlock.difficulty = toInt(_o["currentDifficulty"]); - m_environment.currentBlock.timestamp() = toInt(_o["currentTimestamp"]); - m_environment.currentBlock.coinbaseAddress() = Address(_o["currentCoinbase"].get_str()); + RLPStream rlpStream; + rlpStream.appendList(BlockInfo::BasicFields); + rlpStream << h256(_o["previousHash"].get_str()); + rlpStream << EmptyListSHA3; + rlpStream << Address(_o["currentCoinbase"].get_str()); + rlpStream << h256(); // stateRoot + rlpStream << EmptyTrie; // transactionTrie + rlpStream << EmptyTrie; // receiptTrie + rlpStream << LogBloom(); // bloom + rlpStream << toInt(_o["currentDifficulty"]); + rlpStream << toInt(_o["currentNumber"]); + rlpStream << toInt(_o["currentGasLimit"]); + rlpStream << 0; //gasUsed + rlpStream << toInt(_o["currentTimestamp"]); + rlpStream << std::string(); //extra data + + m_environment.currentBlock = BlockInfo(rlpStream.out(), CheckEverything, h256{}, HeaderData); m_statePre.m_previousBlock = m_environment.previousBlock; m_statePre.m_currentBlock = m_environment.currentBlock; } @@ -824,6 +820,43 @@ LastHashes lastHashes(u256 _currentBlockNumber) return ret; } +dev::eth::Ethash::BlockHeader constructHeader( + h256 const& _parentHash, + h256 const& _sha3Uncles, + Address const& _coinbaseAddress, + h256 const& _stateRoot, + h256 const& _transactionsRoot, + h256 const& _receiptsRoot, + dev::eth::LogBloom const& _logBloom, + u256 const& _difficulty, + u256 const& _number, + u256 const& _gasLimit, + u256 const& _gasUsed, + u256 const& _timestamp, + bytes const& _extraData) +{ + RLPStream rlpStream; + rlpStream.appendList(Ethash::BlockHeader::Fields); + + rlpStream << _parentHash << _sha3Uncles << _coinbaseAddress << _stateRoot << _transactionsRoot << _receiptsRoot << _logBloom + << _difficulty << _number << _gasLimit << _gasUsed << _timestamp << _extraData << h256{} << Nonce{}; + + return Ethash::BlockHeader(rlpStream.out()); +} + +void updateEthashSeal(dev::eth::Ethash::BlockHeader& _header, h256 const& _mixHash, dev::eth::Nonce const& _nonce) +{ + RLPStream source; + _header.streamRLP(source); + RLP sourceRlp(source.out()); + RLPStream header; + header.appendList(Ethash::BlockHeader::Fields); + for (size_t i = 0; i < BlockInfo::BasicFields; i++) + header << sourceRlp[i]; + + header << _mixHash << _nonce; + _header = Ethash::BlockHeader(header.out()); +} namespace { diff --git a/TestHelper.h b/TestHelper.h index 420278838..48eb42c55 100644 --- a/TestHelper.h +++ b/TestHelper.h @@ -27,6 +27,7 @@ #include #include "JsonSpiritHeaders.h" +#include #include #include #include @@ -62,7 +63,7 @@ class State; void mine(Client& c, int numBlocks); void connectClients(Client& c1, Client& c2); void mine(State& _s, BlockChain const& _bc); -void mine(BlockInfo& _bi); +void mine(Ethash::BlockHeader& _bi); } @@ -175,7 +176,21 @@ void checkOutput(bytes const& _output, json_spirit::mObject& _o); void checkStorage(std::map _expectedStore, std::map _resultStore, Address _expectedAddr); void checkLog(eth::LogEntries _resultLogs, eth::LogEntries _expectedLogs); void checkCallCreates(eth::Transactions _resultCallCreates, eth::Transactions _expectedCallCreates); - +dev::eth::Ethash::BlockHeader constructHeader( + h256 const& _parentHash, + h256 const& _sha3Uncles, + Address const& _coinbaseAddress, + h256 const& _stateRoot, + h256 const& _transactionsRoot, + h256 const& _receiptsRoot, + dev::eth::LogBloom const& _logBloom, + u256 const& _difficulty, + u256 const& _number, + u256 const& _gasLimit, + u256 const& _gasUsed, + u256 const& _timestamp, + bytes const& _extraData); +void updateEthashSeal(dev::eth::Ethash::BlockHeader& _header, h256 const& _mixHash, dev::eth::Nonce const& _nonce); void executeTests(const std::string& _name, const std::string& _testPathAppendix, const boost::filesystem::path _pathToFiller, std::function doTests); void userDefinedTest(std::function doTests); RLPStream createRLPStreamFromTransactionFields(json_spirit::mObject& _tObj); From 6640aedb6ccf3813aaece7918ebb9cae831c2e38 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Sun, 19 Jul 2015 19:15:45 +0200 Subject: [PATCH 30/38] Fix for stateroot in tests. From d0e7e6295c89c40d9ef9a9c665059c97ddcfb89f Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Mon, 6 Jul 2015 18:59:19 -0700 Subject: [PATCH 31/38] Modularise nonce, mix hash and seed hash. --- TestHelper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TestHelper.cpp b/TestHelper.cpp index f49ed1e09..b43c4db51 100644 --- a/TestHelper.cpp +++ b/TestHelper.cpp @@ -81,7 +81,7 @@ void mine(BlockInfo& _bi) bool completed = false; f.onSolutionFound([&](ProofOfWork::Solution sol) { - ProofOfWork::assignResult(sol, _bi); + _bi.proof = sol; return completed = true; }); f.setWork(_bi); From c30de11a76f986b8b1548d57f541a18776312ed0 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Wed, 15 Jul 2015 23:24:10 +0200 Subject: [PATCH 32/38] Basic test working with same code for Ethash and BasicAuthority. From 07a29389d6b13b82c3e2d55fbf62cc08124c4cbc Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Thu, 16 Jul 2015 01:29:03 +0200 Subject: [PATCH 33/38] All fields of BlockInfo now private. --- TestHelper.cpp | 6 +++--- libsolidity/SolidityEndToEndTest.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/TestHelper.cpp b/TestHelper.cpp index b43c4db51..bae980a7e 100644 --- a/TestHelper.cpp +++ b/TestHelper.cpp @@ -151,12 +151,12 @@ void ImportTest::importEnv(json_spirit::mObject& _o) assert(_o.count("currentCoinbase") > 0); assert(_o.count("currentNumber") > 0); - m_environment.currentBlock.parentHash = h256(_o["previousHash"].get_str()); + m_environment.currentBlock.parentHash() = h256(_o["previousHash"].get_str()); m_environment.currentBlock.number = toInt(_o["currentNumber"]); m_environment.currentBlock.gasLimit = toInt(_o["currentGasLimit"]); m_environment.currentBlock.difficulty = toInt(_o["currentDifficulty"]); - m_environment.currentBlock.timestamp = toInt(_o["currentTimestamp"]); - m_environment.currentBlock.coinbaseAddress = Address(_o["currentCoinbase"].get_str()); + m_environment.currentBlock.timestamp() = toInt(_o["currentTimestamp"]); + m_environment.currentBlock.coinbaseAddress() = Address(_o["currentCoinbase"].get_str()); m_statePre.m_previousBlock = m_environment.previousBlock; m_statePre.m_currentBlock = m_environment.currentBlock; diff --git a/libsolidity/SolidityEndToEndTest.cpp b/libsolidity/SolidityEndToEndTest.cpp index d44545145..4a6507cd6 100644 --- a/libsolidity/SolidityEndToEndTest.cpp +++ b/libsolidity/SolidityEndToEndTest.cpp @@ -1188,7 +1188,7 @@ BOOST_AUTO_TEST_CASE(now) { char const* sourceCode = "contract test {\n" " function someInfo() returns (bool success) {\n" - " return block.timestamp == now && now > 0;\n" + " return block.timestamp() == now && now > 0;\n" " }\n" "}\n"; compileAndRun(sourceCode); From 32916c3362bf7d10448db56abc0f12ca63d2b60b Mon Sep 17 00:00:00 2001 From: arkpar Date: Thu, 16 Jul 2015 18:11:08 +0200 Subject: [PATCH 34/38] started tests refactoring --- TestHelper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TestHelper.cpp b/TestHelper.cpp index bae980a7e..30f323369 100644 --- a/TestHelper.cpp +++ b/TestHelper.cpp @@ -63,7 +63,7 @@ void connectClients(Client& c1, Client& c2) void mine(State& s, BlockChain const& _bc) { s.commitToMine(_bc); - GenericFarm f; + GenericFarm f; bool completed = false; f.onSolutionFound([&](ProofOfWork::Solution sol) { From 522d9f1e46c362967487b7c0aeb986dc0d01bf72 Mon Sep 17 00:00:00 2001 From: arkpar Date: Thu, 16 Jul 2015 20:53:58 +0200 Subject: [PATCH 35/38] eth working --- TestHelper.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/TestHelper.cpp b/TestHelper.cpp index 30f323369..c29788b9f 100644 --- a/TestHelper.cpp +++ b/TestHelper.cpp @@ -23,6 +23,7 @@ #include #include +#include #include #include #include @@ -63,11 +64,17 @@ void connectClients(Client& c1, Client& c2) void mine(State& s, BlockChain const& _bc) { s.commitToMine(_bc); - GenericFarm f; + GenericFarm f; bool completed = false; - f.onSolutionFound([&](ProofOfWork::Solution sol) + Ethash::BlockHeader header(s.info); + f.onSolutionFound([&](EthashProofOfWork::Solution sol) { - return completed = s.completeMine(sol); + header.m_mixHash = sol.mixHash; + header.m_nonce = sol.nonce; + RLPStream ret; + header.streamRLP(ret); + s.sealBlock(ret); + return true; }); f.setWork(s.info()); f.startCPU(); @@ -77,9 +84,9 @@ void mine(State& s, BlockChain const& _bc) void mine(BlockInfo& _bi) { - GenericFarm f; + GenericFarm f; bool completed = false; - f.onSolutionFound([&](ProofOfWork::Solution sol) + f.onSolutionFound([&](EthashProofOfWork::Solution sol) { _bi.proof = sol; return completed = true; From e2a1473d9287a3257d0400ac4d45ab0ce86402f9 Mon Sep 17 00:00:00 2001 From: arkpar Date: Sat, 18 Jul 2015 15:19:15 +0200 Subject: [PATCH 36/38] tests repared --- TestHelper.cpp | 101 ++++++++++++++++++++++++++++++++----------------- TestHelper.h | 19 +++++++++- 2 files changed, 84 insertions(+), 36 deletions(-) diff --git a/TestHelper.cpp b/TestHelper.cpp index c29788b9f..aec72285c 100644 --- a/TestHelper.cpp +++ b/TestHelper.cpp @@ -63,38 +63,23 @@ void connectClients(Client& c1, Client& c2) void mine(State& s, BlockChain const& _bc) { + std::unique_ptr sealer(Ethash::createSealEngine()); s.commitToMine(_bc); - GenericFarm f; - bool completed = false; - Ethash::BlockHeader header(s.info); - f.onSolutionFound([&](EthashProofOfWork::Solution sol) - { - header.m_mixHash = sol.mixHash; - header.m_nonce = sol.nonce; - RLPStream ret; - header.streamRLP(ret); - s.sealBlock(ret); - return true; - }); - f.setWork(s.info()); - f.startCPU(); - while (!completed) - this_thread::sleep_for(chrono::milliseconds(20)); + Notified sealed; + sealer->onSealGenerated([&](bytes const& sealedHeader){ sealed = sealedHeader; }); + sealer->generateSeal(s.info()); + sealed.waitNot({}); + s.sealBlock(sealed); } -void mine(BlockInfo& _bi) +void mine(Ethash::BlockHeader& _bi) { - GenericFarm f; - bool completed = false; - f.onSolutionFound([&](EthashProofOfWork::Solution sol) - { - _bi.proof = sol; - return completed = true; - }); - f.setWork(_bi); - f.startCPU(); - while (!completed) - this_thread::sleep_for(chrono::milliseconds(20)); + std::unique_ptr sealer(Ethash::createSealEngine()); + Notified sealed; + sealer->onSealGenerated([&](bytes const& sealedHeader){ sealed = sealedHeader; }); + sealer->generateSeal(_bi); + sealed.waitNot({}); + _bi = Ethash::BlockHeader(sealed); } } @@ -158,13 +143,24 @@ void ImportTest::importEnv(json_spirit::mObject& _o) assert(_o.count("currentCoinbase") > 0); assert(_o.count("currentNumber") > 0); - m_environment.currentBlock.parentHash() = h256(_o["previousHash"].get_str()); - m_environment.currentBlock.number = toInt(_o["currentNumber"]); - m_environment.currentBlock.gasLimit = toInt(_o["currentGasLimit"]); - m_environment.currentBlock.difficulty = toInt(_o["currentDifficulty"]); - m_environment.currentBlock.timestamp() = toInt(_o["currentTimestamp"]); - m_environment.currentBlock.coinbaseAddress() = Address(_o["currentCoinbase"].get_str()); + RLPStream rlpStream; + rlpStream.appendList(BlockInfo::BasicFields); + rlpStream << h256(_o["previousHash"].get_str()); + rlpStream << EmptyListSHA3; + rlpStream << Address(_o["currentCoinbase"].get_str()); + rlpStream << h256(); // stateRoot + rlpStream << EmptyTrie; // transactionTrie + rlpStream << EmptyTrie; // receiptTrie + rlpStream << LogBloom(); // bloom + rlpStream << toInt(_o["currentDifficulty"]); + rlpStream << toInt(_o["currentNumber"]); + rlpStream << toInt(_o["currentGasLimit"]); + rlpStream << 0; //gasUsed + rlpStream << toInt(_o["currentTimestamp"]); + rlpStream << std::string(); //extra data + + m_environment.currentBlock = BlockInfo(rlpStream.out(), CheckEverything, h256{}, HeaderData); m_statePre.m_previousBlock = m_environment.previousBlock; m_statePre.m_currentBlock = m_environment.currentBlock; } @@ -824,6 +820,43 @@ LastHashes lastHashes(u256 _currentBlockNumber) return ret; } +dev::eth::Ethash::BlockHeader constructHeader( + h256 const& _parentHash, + h256 const& _sha3Uncles, + Address const& _coinbaseAddress, + h256 const& _stateRoot, + h256 const& _transactionsRoot, + h256 const& _receiptsRoot, + dev::eth::LogBloom const& _logBloom, + u256 const& _difficulty, + u256 const& _number, + u256 const& _gasLimit, + u256 const& _gasUsed, + u256 const& _timestamp, + bytes const& _extraData) +{ + RLPStream rlpStream; + rlpStream.appendList(Ethash::BlockHeader::Fields); + + rlpStream << _parentHash << _sha3Uncles << _coinbaseAddress << _stateRoot << _transactionsRoot << _receiptsRoot << _logBloom + << _difficulty << _number << _gasLimit << _gasUsed << _timestamp << _extraData << h256{} << Nonce{}; + + return Ethash::BlockHeader(rlpStream.out()); +} + +void updateEthashSeal(dev::eth::Ethash::BlockHeader& _header, h256 const& _mixHash, dev::eth::Nonce const& _nonce) +{ + RLPStream source; + _header.streamRLP(source); + RLP sourceRlp(source.out()); + RLPStream header; + header.appendList(Ethash::BlockHeader::Fields); + for (size_t i = 0; i < BlockInfo::BasicFields; i++) + header << sourceRlp[i]; + + header << _mixHash << _nonce; + _header = Ethash::BlockHeader(header.out()); +} namespace { diff --git a/TestHelper.h b/TestHelper.h index 4ac59e917..735535492 100644 --- a/TestHelper.h +++ b/TestHelper.h @@ -27,6 +27,7 @@ #include #include "JsonSpiritHeaders.h" +#include #include #include #include @@ -62,7 +63,7 @@ class State; void mine(Client& c, int numBlocks); void connectClients(Client& c1, Client& c2); void mine(State& _s, BlockChain const& _bc); -void mine(BlockInfo& _bi); +void mine(Ethash::BlockHeader& _bi); } @@ -175,7 +176,21 @@ void checkOutput(bytes const& _output, json_spirit::mObject& _o); void checkStorage(std::map _expectedStore, std::map _resultStore, Address _expectedAddr); void checkLog(eth::LogEntries _resultLogs, eth::LogEntries _expectedLogs); void checkCallCreates(eth::Transactions _resultCallCreates, eth::Transactions _expectedCallCreates); - +dev::eth::Ethash::BlockHeader constructHeader( + h256 const& _parentHash, + h256 const& _sha3Uncles, + Address const& _coinbaseAddress, + h256 const& _stateRoot, + h256 const& _transactionsRoot, + h256 const& _receiptsRoot, + dev::eth::LogBloom const& _logBloom, + u256 const& _difficulty, + u256 const& _number, + u256 const& _gasLimit, + u256 const& _gasUsed, + u256 const& _timestamp, + bytes const& _extraData); +void updateEthashSeal(dev::eth::Ethash::BlockHeader& _header, h256 const& _mixHash, dev::eth::Nonce const& _nonce); void executeTests(const std::string& _name, const std::string& _testPathAppendix, const boost::filesystem::path _pathToFiller, std::function doTests); void userDefinedTest(std::function doTests); RLPStream createRLPStreamFromTransactionFields(json_spirit::mObject& _tObj); From 4f2a29853dc1039ced72dc104d362f10fb5dc0bc Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Sun, 19 Jul 2015 19:15:45 +0200 Subject: [PATCH 37/38] Fix for stateroot in tests. From 4046174ea2120e40d87150bfeab51de8e78875e1 Mon Sep 17 00:00:00 2001 From: arkpar Date: Mon, 20 Jul 2015 00:36:48 +0200 Subject: [PATCH 38/38] fixing solidity tests --- libsolidity/SolidityEndToEndTest.cpp | 2 +- libsolidity/solidityExecutionFramework.h | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/libsolidity/SolidityEndToEndTest.cpp b/libsolidity/SolidityEndToEndTest.cpp index 4a6507cd6..d44545145 100644 --- a/libsolidity/SolidityEndToEndTest.cpp +++ b/libsolidity/SolidityEndToEndTest.cpp @@ -1188,7 +1188,7 @@ BOOST_AUTO_TEST_CASE(now) { char const* sourceCode = "contract test {\n" " function someInfo() returns (bool success) {\n" - " return block.timestamp() == now && now > 0;\n" + " return block.timestamp == now && now > 0;\n" " }\n" "}\n"; compileAndRun(sourceCode); diff --git a/libsolidity/solidityExecutionFramework.h b/libsolidity/solidityExecutionFramework.h index f4dbbcb97..0e8637012 100644 --- a/libsolidity/solidityExecutionFramework.h +++ b/libsolidity/solidityExecutionFramework.h @@ -41,7 +41,11 @@ namespace test class ExecutionFramework { public: - ExecutionFramework() { g_logVerbosity = 0; } + ExecutionFramework() + { + g_logVerbosity = 0; + m_state.resetCurrent(); + } bytes const& compileAndRunWithoutCheck( std::string const& _sourceCode,