From 74fafc70d7b50d825d8e46e2de39d95bb0a5fd4f Mon Sep 17 00:00:00 2001 From: MonsieurNicolas Date: Fri, 12 Jul 2019 11:03:58 -0700 Subject: [PATCH 1/4] add missing files to visual studio project --- Builds/VisualStudio/stellar-core.vcxproj | 18 +++++- .../VisualStudio/stellar-core.vcxproj.filters | 59 ++++++++++++++++++- 2 files changed, 75 insertions(+), 2 deletions(-) diff --git a/Builds/VisualStudio/stellar-core.vcxproj b/Builds/VisualStudio/stellar-core.vcxproj index 6a4c79eaa7..0fd37e0c82 100644 --- a/Builds/VisualStudio/stellar-core.vcxproj +++ b/Builds/VisualStudio/stellar-core.vcxproj @@ -257,17 +257,22 @@ exit /b 0 + + + + + @@ -293,6 +298,7 @@ exit /b 0 + @@ -305,6 +311,8 @@ exit /b 0 + + @@ -560,9 +568,12 @@ exit /b 0 + + + @@ -570,6 +581,8 @@ exit /b 0 + + @@ -595,6 +608,7 @@ exit /b 0 + @@ -602,6 +616,8 @@ exit /b 0 + + @@ -1003,4 +1019,4 @@ exit /b 0 - + \ No newline at end of file diff --git a/Builds/VisualStudio/stellar-core.vcxproj.filters b/Builds/VisualStudio/stellar-core.vcxproj.filters index a22bfcd2f9..3ba4d333b7 100644 --- a/Builds/VisualStudio/stellar-core.vcxproj.filters +++ b/Builds/VisualStudio/stellar-core.vcxproj.filters @@ -142,6 +142,15 @@ {2f5780ba-6cc8-45ba-b70b-aa50af3af3ce} + + {d3bc5d86-b218-4775-a47d-8db1a1ec26a0} + + + {03aee051-1ba2-40f7-9551-8dbeaf8c4232} + + + {b342c551-848c-427d-8d3b-df060afe49aa} + @@ -942,6 +951,30 @@ herder + + bucket\tests + + + bucket + + + bucket + + + herder\simulation + + + catchup\simulation + + + catchup\simulation + + + transactions\simulation + + + transactions\simulation + @@ -1628,6 +1661,30 @@ herder + + bucket + + + bucket + + + bucket + + + herder\simulation + + + catchup\simulation + + + catchup\simulation + + + transactions\simulation + + + transactions\simulation + @@ -1785,4 +1842,4 @@ - + \ No newline at end of file From 2ea8ec93a7e2ae1ac93fc0c9633d7c18cda2b18c Mon Sep 17 00:00:00 2001 From: MonsieurNicolas Date: Fri, 12 Jul 2019 11:04:52 -0700 Subject: [PATCH 2/4] warning police --- src/catchup/simulation/ApplyTransactionsWork.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/catchup/simulation/ApplyTransactionsWork.cpp b/src/catchup/simulation/ApplyTransactionsWork.cpp index 7ae0c5fd5a..8609820a66 100644 --- a/src/catchup/simulation/ApplyTransactionsWork.cpp +++ b/src/catchup/simulation/ApplyTransactionsWork.cpp @@ -63,7 +63,7 @@ ApplyTransactionsWork::getNextLedger( } } - uint32_t nOps = 0; + size_t nOps = 0; while (true) { while (mTransactionIter != mTransactionHistory.txSet.txs.cend() && From 7d13aaebb1a3c559897df8cce1cb82eafa4b4cd5 Mon Sep 17 00:00:00 2001 From: MonsieurNicolas Date: Fri, 12 Jul 2019 13:21:52 -0700 Subject: [PATCH 3/4] keep transactions in transaction queue when removing txs that were processed in a ledger --- src/herder/TransactionQueue.cpp | 23 +++++++++++++++-------- src/herder/TransactionQueue.h | 8 +++++--- src/herder/test/TransactionQueueTests.cpp | 4 ++++ 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/src/herder/TransactionQueue.cpp b/src/herder/TransactionQueue.cpp index 765004c7ad..bb9ae1a841 100644 --- a/src/herder/TransactionQueue.cpp +++ b/src/herder/TransactionQueue.cpp @@ -71,7 +71,7 @@ TransactionQueue::removeAndReset( { for (auto const& tx : dropTxs) { - auto extracted = extract(tx); + auto extracted = extract(tx, true); if (extracted.first != std::end(mPendingTransactions)) { extracted.first->second.mAge = 0; @@ -85,7 +85,7 @@ TransactionQueue::ban(std::vector const& dropTxs) auto& bannedFront = mBannedTransactions.front(); for (auto const& tx : dropTxs) { - for (auto const& extracted : extract(tx).second) + for (auto const& extracted : extract(tx, false).second) { bannedFront.insert(extracted->getFullHash()); } @@ -127,7 +127,7 @@ TransactionQueue::find(TransactionFramePtr const& tx) } TransactionQueue::ExtractResult -TransactionQueue::extract(TransactionFramePtr const& tx) +TransactionQueue::extract(TransactionFramePtr const& tx, bool keepBacklog) { auto it = find(tx); auto accIt = it.first; @@ -138,16 +138,23 @@ TransactionQueue::extract(TransactionFramePtr const& tx) auto& txs = accIt->second.mTransactions; auto txIt = it.second; - auto feeBid = - std::accumulate(txIt, std::end(txs), int64_t{0}, + + auto txRemoveEnd = txIt + 1; + if (!keepBacklog) + { + // remove everything passed tx + txRemoveEnd = std::end(txs); + } + auto removedFeeBid = + std::accumulate(txIt, txRemoveEnd, int64_t{0}, [](int64_t fee, TransactionFramePtr const& tx) { return fee + tx->getFeeBid(); }); - accIt->second.mTotalFees -= feeBid; + accIt->second.mTotalFees -= removedFeeBid; auto movedTxs = std::vector{}; - std::move(txIt, std::end(txs), std::back_inserter(movedTxs)); - txs.erase(txIt, std::end(txs)); + std::move(txIt, txRemoveEnd, std::back_inserter(movedTxs)); + txs.erase(txIt, txRemoveEnd); if (accIt->second.mTransactions.empty()) { diff --git a/src/herder/TransactionQueue.h b/src/herder/TransactionQueue.h index b78f687b2a..7f47cbd9dd 100644 --- a/src/herder/TransactionQueue.h +++ b/src/herder/TransactionQueue.h @@ -39,10 +39,11 @@ class Application; * by tryAdd operation. If that succeds, it can be later removed from it in one * of three ways: * * removeAndReset() should be called after transaction is successully - * included into some leger + * included into some leger. It preserves the other pending transactions for + * accounts and resets the TTL for banning * * ban() should be called after transaction became invalid for some reason * (i.e. its source account cannot afford it anymore) - * * shift() should be called after each ledger close, it bans transcations + * * shift() should be called after each ledger close, it bans transactions * that have associated age greater or equal to pendingDepth and removes * transactions that were banned for more than banDepth ledgers * @@ -140,7 +141,8 @@ class TransactionQueue FindResult find(TransactionFramePtr const& tx); using ExtractResult = std::pair>; - ExtractResult extract(TransactionFramePtr const& tx); + // keepBacklog: keeps transactions succeding tx in the account's backlog + ExtractResult extract(TransactionFramePtr const& tx, bool keepBacklog); }; static const char* TX_STATUS_STRING[static_cast( diff --git a/src/herder/test/TransactionQueueTests.cpp b/src/herder/test/TransactionQueueTests.cpp index b83d93f720..1572186f55 100644 --- a/src/herder/test/TransactionQueueTests.cpp +++ b/src/herder/test/TransactionQueueTests.cpp @@ -528,6 +528,8 @@ TEST_CASE("TransactionQueue", "[herder][TransactionQueue]") test.check({{{account1, 1, {txSeqA1T1, txSeqA1T2}}, {account2, 1, {txSeqA2T1, txSeqA2T2}}}}); test.removeAndReset({txSeqA1T1, txSeqA2T2}); + test.check({{{account1, 0, {txSeqA1T2}}, {account2, 0, {txSeqA2T1}}}}); + test.removeAndReset({txSeqA1T2}); test.check({{{account1}, {account2, 0, {txSeqA2T1}}}}); test.add(txSeqA1T1, TransactionQueue::AddResult::ADD_STATUS_PENDING); test.check({{{account1, 0, {txSeqA1T1}}, {account2, 0, {txSeqA2T1}}}}); @@ -535,6 +537,8 @@ TEST_CASE("TransactionQueue", "[herder][TransactionQueue]") test.check({{{account1, 0, {txSeqA1T1}}, {account2, 0, {txSeqA2T1, txSeqA2T2}}}}); test.removeAndReset({txSeqA2T1}); + test.check({{{account1, 0, {txSeqA1T1}}, {account2, 0, {txSeqA2T2}}}}); + test.removeAndReset({txSeqA2T2}); test.check({{{account1, 0, {txSeqA1T1}}, {account2}}}); test.removeAndReset({txSeqA1T1}); test.check({{{account1}, {account2}}}); From 93bb58a366a48e94716a3413f124e952b1440f3e Mon Sep 17 00:00:00 2001 From: MonsieurNicolas Date: Sat, 13 Jul 2019 08:29:50 -0700 Subject: [PATCH 4/4] use less resources when running tests --- src/test/test.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/test/test.cpp b/src/test/test.cpp index 01189eb803..8c6e9d328f 100644 --- a/src/test/test.cpp +++ b/src/test/test.cpp @@ -185,6 +185,9 @@ getTestConfig(int instanceNumber, Config::TestDbMode mode) thisConfig.REPORT_METRICS = gTestMetrics; // disable maintenance thisConfig.AUTOMATIC_MAINTENANCE_COUNT = 0; + // only spin up a small number of worker threads + thisConfig.WORKER_THREADS = 2; + thisConfig.QUORUM_INTERSECTION_CHECKER = false; } return *cfgs[instanceNumber]; }