diff --git a/Builds/VisualStudio/stellar-core.vcxproj b/Builds/VisualStudio/stellar-core.vcxproj index 866dfcc36f..3ad051f4d9 100644 --- a/Builds/VisualStudio/stellar-core.vcxproj +++ b/Builds/VisualStudio/stellar-core.vcxproj @@ -1243,27 +1243,27 @@ exit /b 0 false false false - sh ../../hash-xdrs.sh ../../src/protocol-curr > src/$(Configuration)/generated/xdr/XDRFilesSha256.cpp + wsl bash ../../hash-xdrs.sh ../../src/protocol-curr > src/$(Configuration)/generated/xdr/XDRFilesSha256.cpp running hash-xdrs.sh src/$(Configuration)/generated/xdr/XDRFilesSha256.cpp src/$(Configuration)/generated/xdr/Stellar-overlay.h;src/$(Configuration)/generated/xdr/Stellar-transaction.h;src/$(Configuration)/generated/xdr/Stellar-ledger.h;src/$(Configuration)/generated/xdr/Stellar-ledger-entries.h;src/$(Configuration)/generated/xdr/Stellar-SCP.h;src/$(Configuration)/generated/xdr/Stellar-types.h;src/$(Configuration)/generated/xdr/Stellar-contract-config-setting.h None - sh ../../hash-xdrs.sh ../../src/protocol-next > src/$(Configuration)/generated/xdr/XDRFilesSha256.cpp + wsl bash ../../hash-xdrs.sh ../../src/protocol-next > src/$(Configuration)/generated/xdr/XDRFilesSha256.cpp running hash-xdrs.sh src/$(Configuration)/generated/xdr/XDRFilesSha256.cpp src/$(Configuration)/generated/xdr/Stellar-overlay.h;src/$(Configuration)/generated/xdr/Stellar-transaction.h;src/$(Configuration)/generated/xdr/Stellar-ledger.h;src/$(Configuration)/generated/xdr/Stellar-ledger-entries.h;src/$(Configuration)/generated/xdr/Stellar-SCP.h;src/$(Configuration)/generated/xdr/Stellar-types.h;src/$(Configuration)/generated/xdr/Stellar-contract-config-setting.h None - sh ../../hash-xdrs.sh ../../src/protocol-curr > src/$(Configuration)/generated/xdr/XDRFilesSha256.cpp + wsl bash ../../hash-xdrs.sh ../../src/protocol-curr > src/$(Configuration)/generated/xdr/XDRFilesSha256.cpp running hash-xdrs.sh src/$(Configuration)/generated/xdr/XDRFilesSha256.cpp src/$(Configuration)/generated/xdr/Stellar-overlay.h;src/$(Configuration)/generated/xdr/Stellar-transaction.h;src/$(Configuration)/generated/xdr/Stellar-ledger.h;src/$(Configuration)/generated/xdr/Stellar-ledger-entries.h;src/$(Configuration)/generated/xdr/Stellar-SCP.h;src/$(Configuration)/generated/xdr/Stellar-types.h None - sh ../../hash-xdrs.sh ../../src/protocol-next > src/$(Configuration)/generated/xdr/XDRFilesSha256.cpp + wsl bash ../../hash-xdrs.sh ../../src/protocol-next > src/$(Configuration)/generated/xdr/XDRFilesSha256.cpp running hash-xdrs.sh src/$(Configuration)/generated/xdr/XDRFilesSha256.cpp src/$(Configuration)/generated/xdr/Stellar-overlay.h;src/$(Configuration)/generated/xdr/Stellar-transaction.h;src/$(Configuration)/generated/xdr/Stellar-ledger.h;src/$(Configuration)/generated/xdr/Stellar-ledger-entries.h;src/$(Configuration)/generated/xdr/Stellar-SCP.h;src/$(Configuration)/generated/xdr/Stellar-types.h None - sh ../../hash-xdrs.sh ../../src/protocol-next > src/$(Configuration)/generated/xdr/XDRFilesSha256.cpp + wsl bash ../../hash-xdrs.sh ../../src/protocol-next > src/$(Configuration)/generated/xdr/XDRFilesSha256.cpp running hash-xdrs.sh src/$(Configuration)/generated/xdr/XDRFilesSha256.cpp src/$(Configuration)/generated/xdr/Stellar-overlay.h;src/$(Configuration)/generated/xdr/Stellar-transaction.h;src/$(Configuration)/generated/xdr/Stellar-ledger.h;src/$(Configuration)/generated/xdr/Stellar-ledger-entries.h;src/$(Configuration)/generated/xdr/Stellar-SCP.h;src/$(Configuration)/generated/xdr/Stellar-types.h;src/$(Configuration)/generated/xdr/Stellar-contract-config-setting.h @@ -1550,8 +1550,8 @@ exit /b 0 Document - sed.exe -e "s/%%%%VERSION%%%%/msvc custom/" < %(FullPath) > %(RelativeDir)\StellarCoreVersion.cpp - sed.exe -e "s/%%%%VERSION%%%%/msvc custom/" < %(FullPath) > %(RelativeDir)\StellarCoreVersion.cpp + wsl sed -e "s/%%%%VERSION%%%%/msvc custom/" < %(FullPath) > %(RelativeDir)\StellarCoreVersion.cpp + wsl sed -e "s/%%%%VERSION%%%%/msvc custom/" < %(FullPath) > %(RelativeDir)\StellarCoreVersion.cpp Generating StellarCoreVersion.cpp Generating StellarCoreVersion.cpp ../../src/main/StellarCoreVersion.cpp @@ -1560,9 +1560,9 @@ exit /b 0 - sed.exe -e "s/%%%%VERSION%%%%/msvc custom/" < %(FullPath) > %(RelativeDir)\StellarCoreVersion.cpp - sed.exe -e "s/%%%%VERSION%%%%/msvc custom/" < %(FullPath) > %(RelativeDir)\StellarCoreVersion.cpp - sed.exe -e "s/%%%%VERSION%%%%/msvc custom/" < %(FullPath) > %(RelativeDir)\StellarCoreVersion.cpp + wsl sed -e "s/%%%%VERSION%%%%/msvc custom/" < %(FullPath) > %(RelativeDir)\StellarCoreVersion.cpp + wsl sed -e "s/%%%%VERSION%%%%/msvc custom/" < %(FullPath) > %(RelativeDir)\StellarCoreVersion.cpp + wsl sed -e "s/%%%%VERSION%%%%/msvc custom/" < %(FullPath) > %(RelativeDir)\StellarCoreVersion.cpp Generating StellarCoreVersion.cpp Generating StellarCoreVersion.cpp Generating StellarCoreVersion.cpp @@ -1614,6 +1614,11 @@ $(OutDir)\bin\cxxbridge.exe ..\..\src\rust\src\lib.rs --output src\$(Configurati running bison for XDRQueryParser.yy ../../src/util/xdrquery/XDRQueryParser.h true + wsl bison --defines=../../src/util/xdrquery/XDRQueryParser.h --output=../../src/util/xdrquery/XDRQueryParser.cpp ../../src/util/xdrquery/XDRQueryParser.yy + wsl bison --defines=../../src/util/xdrquery/XDRQueryParser.h --output=../../src/util/xdrquery/XDRQueryParser.cpp ../../src/util/xdrquery/XDRQueryParser.yy + wsl bison --defines=../../src/util/xdrquery/XDRQueryParser.h --output=../../src/util/xdrquery/XDRQueryParser.cpp ../../src/util/xdrquery/XDRQueryParser.yy + wsl bison --defines=../../src/util/xdrquery/XDRQueryParser.h --output=../../src/util/xdrquery/XDRQueryParser.cpp ../../src/util/xdrquery/XDRQueryParser.yy + wsl bison --defines=../../src/util/xdrquery/XDRQueryParser.h --output=../../src/util/xdrquery/XDRQueryParser.cpp ../../src/util/xdrquery/XDRQueryParser.yy Document @@ -1621,6 +1626,11 @@ $(OutDir)\bin\cxxbridge.exe ..\..\src\rust\src\lib.rs --output src\$(Configurati running flex for XDRQueryScanner.ll ../../src/util/xdrquery/XDRQueryScanner.cpp true + wsl flex --outfile=../../src/util/xdrquery/XDRQueryScanner.cpp ../../src/util/xdrquery/XDRQueryScanner.ll + wsl flex --outfile=../../src/util/xdrquery/XDRQueryScanner.cpp ../../src/util/xdrquery/XDRQueryScanner.ll + wsl flex --outfile=../../src/util/xdrquery/XDRQueryScanner.cpp ../../src/util/xdrquery/XDRQueryScanner.ll + wsl flex --outfile=../../src/util/xdrquery/XDRQueryScanner.cpp ../../src/util/xdrquery/XDRQueryScanner.ll + wsl flex --outfile=../../src/util/xdrquery/XDRQueryScanner.cpp ../../src/util/xdrquery/XDRQueryScanner.ll diff --git a/src/bucket/Bucket.cpp b/src/bucket/Bucket.cpp index 9daf36f808..d20a6d82c2 100644 --- a/src/bucket/Bucket.cpp +++ b/src/bucket/Bucket.cpp @@ -5,7 +5,7 @@ // ASIO is somewhat particular about when it gets included -- it wants to be the // first to include -- so we try to include it before everything // else. -#include "util/asio.h" +#include "util/asio.h" // IWYU pragma: keep #include "bucket/Bucket.h" #include "bucket/BucketApplicator.h" #include "bucket/BucketList.h" @@ -16,9 +16,7 @@ #include "bucket/MergeKey.h" #include "crypto/Hex.h" #include "crypto/Random.h" -#include "crypto/SHA.h" #include "database/Database.h" -#include "ledger/LedgerHashUtils.h" #include "ledger/LedgerTxn.h" #include "ledger/LedgerTypeUtils.h" #include "main/Application.h" @@ -26,15 +24,11 @@ #include "util/Fs.h" #include "util/GlobalChecks.h" #include "util/Logging.h" -#include "util/TmpDir.h" #include "util/XDRStream.h" #include "util/types.h" -#include "xdrpp/message.h" #include -#include #include "medida/counter.h" -#include "medida/meter.h" namespace stellar { diff --git a/src/bucket/Bucket.h b/src/bucket/Bucket.h index 6a5c3be7b8..43cb97abfd 100644 --- a/src/bucket/Bucket.h +++ b/src/bucket/Bucket.h @@ -5,16 +5,18 @@ // of this distribution or at http://www.apache.org/licenses/LICENSE-2.0 #include "bucket/BucketIndex.h" -#include "crypto/Hex.h" -#include "overlay/StellarXDR.h" #include "util/NonCopyable.h" #include "util/ProtocolVersion.h" -#include "util/UnorderedMap.h" -#include "util/UnorderedSet.h" -#include "util/XDRStream.h" +#include "xdr/Stellar-ledger.h" +#include #include #include +namespace asio +{ +class io_context; +} + namespace medida { class Counter; diff --git a/src/bucket/BucketApplicator.cpp b/src/bucket/BucketApplicator.cpp index be2d36b29e..7c739aa6f2 100644 --- a/src/bucket/BucketApplicator.cpp +++ b/src/bucket/BucketApplicator.cpp @@ -2,7 +2,7 @@ // under the Apache License, Version 2.0. See the COPYING file at the root // of this distribution or at http://www.apache.org/licenses/LICENSE-2.0 -#include "util/asio.h" +#include "util/asio.h" // IWYU pragma: keep #include "bucket/BucketApplicator.h" #include "bucket/Bucket.h" #include "bucket/BucketList.h" diff --git a/src/bucket/BucketApplicator.h b/src/bucket/BucketApplicator.h index 79e74d1dce..8aa1d0a2a7 100644 --- a/src/bucket/BucketApplicator.h +++ b/src/bucket/BucketApplicator.h @@ -6,9 +6,7 @@ #include "bucket/Bucket.h" #include "bucket/BucketInputIterator.h" -#include "ledger/LedgerHashUtils.h" #include "util/Timer.h" -#include "util/XDRStream.h" #include namespace stellar diff --git a/src/bucket/BucketIndex.h b/src/bucket/BucketIndex.h index 4bbae7e09c..91aa53fa6c 100644 --- a/src/bucket/BucketIndex.h +++ b/src/bucket/BucketIndex.h @@ -4,10 +4,10 @@ // under the Apache License, Version 2.0. See the COPYING file at the root // of this distribution or at http://www.apache.org/licenses/LICENSE-2.0 -#include "bucket/LedgerCmp.h" #include "util/GlobalChecks.h" #include "util/NonCopyable.h" -#include +#include "util/XDROperators.h" // IWYU pragma: keep +#include "xdr/Stellar-ledger-entries.h" #include #include #include diff --git a/src/bucket/BucketIndexImpl.cpp b/src/bucket/BucketIndexImpl.cpp index d601b2ee9e..176615457d 100644 --- a/src/bucket/BucketIndexImpl.cpp +++ b/src/bucket/BucketIndexImpl.cpp @@ -5,8 +5,7 @@ #include "bucket/BucketIndexImpl.h" #include "bucket/Bucket.h" #include "bucket/BucketManager.h" -#include "bucket/LedgerCmp.h" -#include "ledger/LedgerHashUtils.h" +#include "crypto/ShortHash.h" #include "main/Config.h" #include "util/Fs.h" #include "util/LogSlowExecution.h" diff --git a/src/bucket/BucketInputIterator.h b/src/bucket/BucketInputIterator.h index b9280ecad8..02bdb2f3ea 100644 --- a/src/bucket/BucketInputIterator.h +++ b/src/bucket/BucketInputIterator.h @@ -4,7 +4,6 @@ // under the Apache License, Version 2.0. See the COPYING file at the root // of this distribution or at http://www.apache.org/licenses/LICENSE-2.0 -#include "bucket/LedgerCmp.h" #include "util/XDRStream.h" #include "xdr/Stellar-ledger.h" diff --git a/src/bucket/BucketList.cpp b/src/bucket/BucketList.cpp index f127deec05..b49ba3a9b3 100644 --- a/src/bucket/BucketList.cpp +++ b/src/bucket/BucketList.cpp @@ -7,24 +7,16 @@ #include "bucket/BucketInputIterator.h" #include "bucket/BucketManager.h" #include "bucket/BucketSnapshot.h" -#include "bucket/LedgerCmp.h" -#include "crypto/Hex.h" -#include "crypto/Random.h" #include "crypto/SHA.h" -#include "ledger/LedgerHashUtils.h" #include "ledger/LedgerManager.h" #include "ledger/LedgerTxn.h" -#include "ledger/LedgerTypeUtils.h" #include "main/Application.h" #include "util/GlobalChecks.h" #include "util/Logging.h" #include "util/ProtocolVersion.h" -#include "util/UnorderedSet.h" -#include "util/XDRStream.h" #include "util/types.h" #include "medida/counter.h" -#include "medida/metrics_registry.h" #include #include diff --git a/src/bucket/BucketList.h b/src/bucket/BucketList.h index 4e7463e090..3e9960aa8b 100644 --- a/src/bucket/BucketList.h +++ b/src/bucket/BucketList.h @@ -6,12 +6,6 @@ #include "bucket/Bucket.h" #include "bucket/FutureBucket.h" -#include "bucket/LedgerCmp.h" -#include "overlay/StellarXDR.h" -#include "xdrpp/message.h" -#include -#include -#include namespace medida { diff --git a/src/bucket/BucketListSnapshot.cpp b/src/bucket/BucketListSnapshot.cpp index 4f81a3bac0..6a8738f65b 100644 --- a/src/bucket/BucketListSnapshot.cpp +++ b/src/bucket/BucketListSnapshot.cpp @@ -4,11 +4,10 @@ #include "bucket/BucketListSnapshot.h" #include "bucket/BucketInputIterator.h" -#include "crypto/SecretKey.h" +#include "crypto/SecretKey.h" // IWYU pragma: keep #include "ledger/LedgerTxn.h" -#include "medida/meter.h" -#include "medida/metrics_registry.h" +#include "medida/timer.h" namespace stellar { diff --git a/src/bucket/BucketListSnapshot.h b/src/bucket/BucketListSnapshot.h index 3a6ca1351c..2ecc8182fc 100644 --- a/src/bucket/BucketListSnapshot.h +++ b/src/bucket/BucketListSnapshot.h @@ -75,7 +75,7 @@ class SearchableBucketListSnapshot : public NonMovableOrCopyable SearchableBucketListSnapshot(BucketSnapshotManager const& snapshotManager); - friend std::unique_ptr + friend std::shared_ptr BucketSnapshotManager::getSearchableBucketListSnapshot() const; public: diff --git a/src/bucket/BucketManager.h b/src/bucket/BucketManager.h index b48b0a8514..abdb91db8d 100644 --- a/src/bucket/BucketManager.h +++ b/src/bucket/BucketManager.h @@ -5,8 +5,8 @@ // of this distribution or at http://www.apache.org/licenses/LICENSE-2.0 #include "bucket/Bucket.h" -#include "overlay/StellarXDR.h" #include "util/NonCopyable.h" +#include "util/types.h" #include #include #include diff --git a/src/bucket/BucketManagerImpl.cpp b/src/bucket/BucketManagerImpl.cpp index 9e5d25a9f5..facce8fe19 100644 --- a/src/bucket/BucketManagerImpl.cpp +++ b/src/bucket/BucketManagerImpl.cpp @@ -14,19 +14,19 @@ #include "historywork/VerifyBucketWork.h" #include "ledger/LedgerManager.h" #include "ledger/LedgerTxn.h" +#include "ledger/LedgerTypeUtils.h" #include "main/Application.h" #include "main/Config.h" -#include "overlay/StellarXDR.h" #include "util/Fs.h" #include "util/GlobalChecks.h" #include "util/LogSlowExecution.h" #include "util/Logging.h" #include "util/TmpDir.h" #include "util/types.h" +#include "xdr/Stellar-ledger.h" #include #include #include -#include #include #include #include diff --git a/src/bucket/BucketManagerImpl.h b/src/bucket/BucketManagerImpl.h index 893ead2b54..0643171b0b 100644 --- a/src/bucket/BucketManagerImpl.h +++ b/src/bucket/BucketManagerImpl.h @@ -3,7 +3,7 @@ #include "bucket/BucketList.h" #include "bucket/BucketManager.h" #include "bucket/BucketMergeMap.h" -#include "overlay/StellarXDR.h" +#include "xdr/Stellar-ledger.h" #include #include @@ -109,7 +109,7 @@ class BucketManagerImpl : public BucketManager std::string const& getTmpDir() override; std::string const& getBucketDir() const override; BucketList& getBucketList() override; - BucketSnapshotManager& getBucketSnapshotManager() const; + BucketSnapshotManager& getBucketSnapshotManager() const override; medida::Timer& getMergeTimer() override; MergeCounters readMergeCounters() override; void incrMergeCounters(MergeCounters const&) override; diff --git a/src/bucket/BucketMergeMap.h b/src/bucket/BucketMergeMap.h index 42df4f9032..fde2bceee4 100644 --- a/src/bucket/BucketMergeMap.h +++ b/src/bucket/BucketMergeMap.h @@ -1,7 +1,7 @@ #pragma once #include "bucket/MergeKey.h" -#include "util/HashOfHash.h" +#include "util/HashOfHash.h" // IWYU pragma: keep #include "util/UnorderedMap.h" #include "util/UnorderedSet.h" #include "xdr/Stellar-types.h" diff --git a/src/bucket/BucketOutputIterator.cpp b/src/bucket/BucketOutputIterator.cpp index 4e6ec984cc..412cfad724 100644 --- a/src/bucket/BucketOutputIterator.cpp +++ b/src/bucket/BucketOutputIterator.cpp @@ -6,7 +6,6 @@ #include "bucket/Bucket.h" #include "bucket/BucketIndex.h" #include "bucket/BucketManager.h" -#include "crypto/Random.h" #include "util/GlobalChecks.h" #include #include diff --git a/src/bucket/BucketSnapshot.cpp b/src/bucket/BucketSnapshot.cpp index f75abe5164..085b901ae2 100644 --- a/src/bucket/BucketSnapshot.cpp +++ b/src/bucket/BucketSnapshot.cpp @@ -7,8 +7,7 @@ #include "bucket/BucketListSnapshot.h" #include "ledger/LedgerTxn.h" #include "ledger/LedgerTypeUtils.h" - -#include "medida/counter.h" +#include "util/XDRStream.h" namespace stellar { diff --git a/src/bucket/BucketSnapshot.h b/src/bucket/BucketSnapshot.h index c0d378d8ed..b01da4996c 100644 --- a/src/bucket/BucketSnapshot.h +++ b/src/bucket/BucketSnapshot.h @@ -4,10 +4,10 @@ // under the Apache License, Version 2.0. See the COPYING file at the root // of this distribution or at http://www.apache.org/licenses/LICENSE-2.0 +#include "bucket/LedgerCmp.h" #include "util/NonCopyable.h" -#include "util/UnorderedMap.h" -#include "util/UnorderedSet.h" -#include "util/types.h" +#include +#include #include diff --git a/src/bucket/BucketSnapshotManager.cpp b/src/bucket/BucketSnapshotManager.cpp index 937ff8a975..28c49f09b6 100644 --- a/src/bucket/BucketSnapshotManager.cpp +++ b/src/bucket/BucketSnapshotManager.cpp @@ -5,6 +5,7 @@ #include "bucket/BucketSnapshotManager.h" #include "bucket/BucketListSnapshot.h" #include "main/Application.h" +#include "util/XDRStream.h" // IWYU pragma: keep #include "medida/meter.h" #include "medida/metrics_registry.h" @@ -26,11 +27,11 @@ BucketSnapshotManager::BucketSnapshotManager( releaseAssert(threadIsMain()); } -std::unique_ptr +std::shared_ptr BucketSnapshotManager::getSearchableBucketListSnapshot() const { - // Can't use std::make_unique due to private constructor - return std::unique_ptr( + // Can't use std::make_shared due to private constructor + return std::shared_ptr( new SearchableBucketListSnapshot(*this)); } diff --git a/src/bucket/BucketSnapshotManager.h b/src/bucket/BucketSnapshotManager.h index 882784a2c3..20604bf0cc 100644 --- a/src/bucket/BucketSnapshotManager.h +++ b/src/bucket/BucketSnapshotManager.h @@ -7,7 +7,6 @@ #include "bucket/BucketManagerImpl.h" #include "util/NonCopyable.h" #include "util/UnorderedMap.h" -#include "util/types.h" #include #include @@ -70,7 +69,7 @@ class BucketSnapshotManager : NonMovableOrCopyable BucketSnapshotManager(Application& app, std::unique_ptr&& snapshot); - std::unique_ptr + std::shared_ptr getSearchableBucketListSnapshot() const; // Checks if snapshot is out of date with mCurrentSnapshot and updates diff --git a/src/bucket/FutureBucket.cpp b/src/bucket/FutureBucket.cpp index 00bffd9ca0..1b3921f5e1 100644 --- a/src/bucket/FutureBucket.cpp +++ b/src/bucket/FutureBucket.cpp @@ -5,7 +5,7 @@ // ASIO is somewhat particular about when it gets included -- it wants to be the // first to include -- so we try to include it before everything // else. -#include "util/asio.h" +#include "util/asio.h" // IWYU pragma: keep #include "bucket/Bucket.h" #include "bucket/BucketList.h" diff --git a/src/bucket/FutureBucket.h b/src/bucket/FutureBucket.h index b644c2f92f..4866d90235 100644 --- a/src/bucket/FutureBucket.h +++ b/src/bucket/FutureBucket.h @@ -4,7 +4,7 @@ // under the Apache License, Version 2.0. See the COPYING file at the root // of this distribution or at http://www.apache.org/licenses/LICENSE-2.0 -#include "overlay/StellarXDR.h" +#include "util/GlobalChecks.h" #include #include #include @@ -176,7 +176,7 @@ class FutureBucket ar(cereal::make_nvp("state", FB_CLEAR)); break; default: - assert(false); + releaseAssert(false); break; } } diff --git a/src/bucket/LedgerCmp.h b/src/bucket/LedgerCmp.h index 392d7e6c30..6551448f97 100644 --- a/src/bucket/LedgerCmp.h +++ b/src/bucket/LedgerCmp.h @@ -6,8 +6,9 @@ #include -#include "overlay/StellarXDR.h" -#include "util/XDROperators.h" +#include "util/XDROperators.h" // IWYU pragma: keep +#include "xdr/Stellar-ledger-entries.h" +#include "xdr/Stellar-ledger.h" namespace stellar { diff --git a/src/bucket/MergeKey.h b/src/bucket/MergeKey.h index 8b3a019fe7..e9098f26ac 100644 --- a/src/bucket/MergeKey.h +++ b/src/bucket/MergeKey.h @@ -5,7 +5,6 @@ // of this distribution or at http://www.apache.org/licenses/LICENSE-2.0 #include "bucket/Bucket.h" #include "xdr/Stellar-types.h" -#include #include #include diff --git a/src/bucket/test/BucketListTests.cpp b/src/bucket/test/BucketListTests.cpp index e9f6414d56..edb8276fba 100644 --- a/src/bucket/test/BucketListTests.cpp +++ b/src/bucket/test/BucketListTests.cpp @@ -17,6 +17,8 @@ #include "bucket/BucketManager.h" #include "bucket/BucketOutputIterator.h" #include "bucket/test/BucketTestUtils.h" +#include "crypto/Hex.h" +#include "ledger/LedgerTypeUtils.h" #include "ledger/test/LedgerTestUtils.h" #include "lib/catch.hpp" #include "lib/util/stdrandom.h" diff --git a/src/bucket/test/BucketTestUtils.cpp b/src/bucket/test/BucketTestUtils.cpp index e7beffe957..201cde9ba2 100644 --- a/src/bucket/test/BucketTestUtils.cpp +++ b/src/bucket/test/BucketTestUtils.cpp @@ -5,6 +5,7 @@ #include "BucketTestUtils.h" #include "bucket/BucketInputIterator.h" #include "bucket/BucketManager.h" +#include "crypto/Hex.h" #include "herder/Herder.h" #include "ledger/LedgerTxn.h" #include "main/Application.h" diff --git a/src/catchup/ApplyBufferedLedgersWork.cpp b/src/catchup/ApplyBufferedLedgersWork.cpp index 6b5865b344..6af378daf4 100644 --- a/src/catchup/ApplyBufferedLedgersWork.cpp +++ b/src/catchup/ApplyBufferedLedgersWork.cpp @@ -6,6 +6,7 @@ #include "bucket/BucketList.h" #include "bucket/BucketManager.h" #include "catchup/ApplyLedgerWork.h" +#include "crypto/Hex.h" #include "ledger/LedgerManager.h" #include "main/Application.h" #include diff --git a/src/catchup/AssumeStateWork.cpp b/src/catchup/AssumeStateWork.cpp index a02c9743df..aa7e9a8e4f 100644 --- a/src/catchup/AssumeStateWork.cpp +++ b/src/catchup/AssumeStateWork.cpp @@ -6,6 +6,7 @@ #include "bucket/BucketList.h" #include "bucket/BucketManager.h" #include "catchup/IndexBucketsWork.h" +#include "crypto/Hex.h" #include "history/HistoryArchive.h" #include "work/WorkSequence.h" #include "work/WorkWithCallback.h" diff --git a/src/catchup/IndexBucketsWork.cpp b/src/catchup/IndexBucketsWork.cpp index b68999102e..5019b48757 100644 --- a/src/catchup/IndexBucketsWork.cpp +++ b/src/catchup/IndexBucketsWork.cpp @@ -7,6 +7,7 @@ #include "bucket/BucketManager.h" #include "util/HashOfHash.h" #include "util/UnorderedSet.h" +#include "util/XDRStream.h" #include "util/types.h" #include "work/WorkWithCallback.h" #include diff --git a/src/herder/Upgrades.cpp b/src/herder/Upgrades.cpp index 5a8790d240..58ac984234 100644 --- a/src/herder/Upgrades.cpp +++ b/src/herder/Upgrades.cpp @@ -13,6 +13,7 @@ #include "ledger/LedgerTxn.h" #include "ledger/LedgerTxnEntry.h" #include "ledger/LedgerTxnHeader.h" +#include "ledger/LedgerTypeUtils.h" #include "ledger/NetworkConfig.h" #include "ledger/TrustLineWrapper.h" #include "main/Config.h" diff --git a/src/herder/test/HerderTests.cpp b/src/herder/test/HerderTests.cpp index 0e027c7650..eb9309b586 100644 --- a/src/herder/test/HerderTests.cpp +++ b/src/herder/test/HerderTests.cpp @@ -5856,17 +5856,10 @@ TEST_CASE("exclude transactions by operation type", "[herder]") // ledger `n-1` when closing ledger `n` TEST_CASE("SCP message capture from previous ledger", "[herder]") { - constexpr uint32_t version = - static_cast(SOROBAN_PROTOCOL_VERSION); - // Initialize simulation auto networkID = sha256(getTestConfig().NETWORK_PASSPHRASE); - auto simulation = std::make_shared( - Simulation::OVER_LOOPBACK, networkID, [version](int i) { - auto cfg = getTestConfig(i, Config::TESTDB_ON_DISK_SQLITE); - cfg.TESTING_UPGRADE_LEDGER_PROTOCOL_VERSION = version; - return cfg; - }); + auto simulation = + std::make_shared(Simulation::OVER_LOOPBACK, networkID); // Create three validators: A, B, and C auto validatorAKey = SecretKey::fromSeed(sha256("validator-A")); diff --git a/src/herder/test/UpgradesTests.cpp b/src/herder/test/UpgradesTests.cpp index 46f03adcea..bc785006f4 100644 --- a/src/herder/test/UpgradesTests.cpp +++ b/src/herder/test/UpgradesTests.cpp @@ -17,6 +17,7 @@ #include "ledger/LedgerTxn.h" #include "ledger/LedgerTxnEntry.h" #include "ledger/LedgerTxnHeader.h" +#include "ledger/LedgerTypeUtils.h" #include "ledger/NetworkConfig.h" #include "ledger/TrustLineWrapper.h" #include "lib/catch.hpp" diff --git a/src/historywork/CheckSingleLedgerHeaderWork.cpp b/src/historywork/CheckSingleLedgerHeaderWork.cpp index 528a41aebd..8209cc35aa 100644 --- a/src/historywork/CheckSingleLedgerHeaderWork.cpp +++ b/src/historywork/CheckSingleLedgerHeaderWork.cpp @@ -10,6 +10,7 @@ #include "util/GlobalChecks.h" #include "util/Logging.h" #include "util/TmpDir.h" +#include "util/XDRStream.h" #include "xdrpp/printer.h" namespace stellar diff --git a/src/invariant/test/BucketListIsConsistentWithDatabaseTests.cpp b/src/invariant/test/BucketListIsConsistentWithDatabaseTests.cpp index 8b26601a1a..7a6b0731e3 100644 --- a/src/invariant/test/BucketListIsConsistentWithDatabaseTests.cpp +++ b/src/invariant/test/BucketListIsConsistentWithDatabaseTests.cpp @@ -163,11 +163,10 @@ struct BucketListGenerator generateDeadEntries(AbstractLedgerTxn& ltx) { UnorderedSet liveDeletable(mLiveKeys.size()); - std::copy_if(mLiveKeys.begin(), mLiveKeys.end(), - std::inserter(liveDeletable, liveDeletable.end()), - [this](LedgerKey const& key) { - return key.type() != CONFIG_SETTING; - }); + std::copy_if( + mLiveKeys.begin(), mLiveKeys.end(), + std::inserter(liveDeletable, liveDeletable.end()), + [](LedgerKey const& key) { return key.type() != CONFIG_SETTING; }); std::vector dead; while (dead.size() < 2 && !liveDeletable.empty()) diff --git a/src/ledger/InMemoryLedgerTxnRoot.cpp b/src/ledger/InMemoryLedgerTxnRoot.cpp index 181901dced..9c75fef14c 100644 --- a/src/ledger/InMemoryLedgerTxnRoot.cpp +++ b/src/ledger/InMemoryLedgerTxnRoot.cpp @@ -6,6 +6,7 @@ #include "ledger/LedgerRange.h" #include "ledger/LedgerTxn.h" #include "util/XDROperators.h" +#include "util/XDRStream.h" #include "util/types.h" #include "xdr/Stellar-ledger-entries.h" #include "xdrpp/marshal.h" diff --git a/src/ledger/LedgerCloseMetaFrame.cpp b/src/ledger/LedgerCloseMetaFrame.cpp index 03525b83cc..b4ef7a9429 100644 --- a/src/ledger/LedgerCloseMetaFrame.cpp +++ b/src/ledger/LedgerCloseMetaFrame.cpp @@ -4,6 +4,7 @@ #include "ledger/LedgerCloseMetaFrame.h" #include "crypto/SHA.h" +#include "ledger/LedgerTypeUtils.h" #include "transactions/TransactionMetaFrame.h" #include "util/GlobalChecks.h" #include "util/ProtocolVersion.h" diff --git a/src/ledger/LedgerHashUtils.h b/src/ledger/LedgerHashUtils.h index 44dc16eda0..7966a5cc8f 100644 --- a/src/ledger/LedgerHashUtils.h +++ b/src/ledger/LedgerHashUtils.h @@ -6,7 +6,6 @@ #include "crypto/ShortHash.h" #include "ledger/InternalLedgerEntry.h" -#include "ledger/LedgerTypeUtils.h" #include "util/HashOfHash.h" #include "xdr/Stellar-ledger-entries.h" #include "xdr/Stellar-ledger.h" diff --git a/src/ledger/LedgerTxn.cpp b/src/ledger/LedgerTxn.cpp index b34010ddad..a869193855 100644 --- a/src/ledger/LedgerTxn.cpp +++ b/src/ledger/LedgerTxn.cpp @@ -14,11 +14,13 @@ #include "ledger/LedgerTxnEntry.h" #include "ledger/LedgerTxnHeader.h" #include "ledger/LedgerTxnImpl.h" +#include "ledger/LedgerTypeUtils.h" #include "ledger/NonSociRelatedException.h" #include "main/Application.h" #include "transactions/TransactionUtils.h" #include "util/GlobalChecks.h" #include "util/XDROperators.h" +#include "util/XDRStream.h" #include "util/types.h" #include "xdr/Stellar-ledger-entries.h" #include "xdrpp/marshal.h" diff --git a/src/ledger/LedgerTxnAccountSQL.cpp b/src/ledger/LedgerTxnAccountSQL.cpp index 47fd4aef38..db51158f65 100644 --- a/src/ledger/LedgerTxnAccountSQL.cpp +++ b/src/ledger/LedgerTxnAccountSQL.cpp @@ -8,6 +8,7 @@ #include "database/Database.h" #include "database/DatabaseTypeSpecificOperation.h" #include "ledger/LedgerTxnImpl.h" +#include "ledger/LedgerTypeUtils.h" #include "main/Application.h" #include "util/Decoder.h" #include "util/GlobalChecks.h" diff --git a/src/ledger/LedgerTxnClaimableBalanceSQL.cpp b/src/ledger/LedgerTxnClaimableBalanceSQL.cpp index 2b12b8541b..e952589209 100644 --- a/src/ledger/LedgerTxnClaimableBalanceSQL.cpp +++ b/src/ledger/LedgerTxnClaimableBalanceSQL.cpp @@ -3,6 +3,7 @@ // of this distribution or at http://www.apache.org/licenses/LICENSE-2.0 #include "ledger/LedgerTxnImpl.h" +#include "ledger/LedgerTypeUtils.h" #include "main/Application.h" #include "util/GlobalChecks.h" #include "util/types.h" diff --git a/src/ledger/LedgerTxnConfigSettingSQL.cpp b/src/ledger/LedgerTxnConfigSettingSQL.cpp index 71d07fd3f5..d06282e203 100644 --- a/src/ledger/LedgerTxnConfigSettingSQL.cpp +++ b/src/ledger/LedgerTxnConfigSettingSQL.cpp @@ -3,6 +3,7 @@ // of this distribution or at http://www.apache.org/licenses/LICENSE-2.0 #include "ledger/LedgerTxnImpl.h" +#include "ledger/LedgerTypeUtils.h" #include "ledger/NonSociRelatedException.h" #include "main/Application.h" #include "util/GlobalChecks.h" diff --git a/src/ledger/LedgerTxnContractCodeSQL.cpp b/src/ledger/LedgerTxnContractCodeSQL.cpp index c3bc17f736..0421e8996c 100644 --- a/src/ledger/LedgerTxnContractCodeSQL.cpp +++ b/src/ledger/LedgerTxnContractCodeSQL.cpp @@ -3,6 +3,7 @@ // of this distribution or at http://www.apache.org/licenses/LICENSE-2.0 #include "ledger/LedgerTxnImpl.h" +#include "ledger/LedgerTypeUtils.h" #include "ledger/NonSociRelatedException.h" #include "main/Application.h" #include "util/GlobalChecks.h" diff --git a/src/ledger/LedgerTxnContractDataSQL.cpp b/src/ledger/LedgerTxnContractDataSQL.cpp index 4f29d5408d..a7f716a561 100644 --- a/src/ledger/LedgerTxnContractDataSQL.cpp +++ b/src/ledger/LedgerTxnContractDataSQL.cpp @@ -3,6 +3,7 @@ // of this distribution or at http://www.apache.org/licenses/LICENSE-2.0 #include "ledger/LedgerTxnImpl.h" +#include "ledger/LedgerTypeUtils.h" #include "ledger/NonSociRelatedException.h" #include "main/Application.h" #include "util/GlobalChecks.h" diff --git a/src/ledger/LedgerTxnDataSQL.cpp b/src/ledger/LedgerTxnDataSQL.cpp index 8bc6435296..a17a38b208 100644 --- a/src/ledger/LedgerTxnDataSQL.cpp +++ b/src/ledger/LedgerTxnDataSQL.cpp @@ -7,6 +7,7 @@ #include "database/Database.h" #include "database/DatabaseTypeSpecificOperation.h" #include "ledger/LedgerTxnImpl.h" +#include "ledger/LedgerTypeUtils.h" #include "main/Application.h" #include "util/Decoder.h" #include "util/GlobalChecks.h" diff --git a/src/ledger/LedgerTxnImpl.h b/src/ledger/LedgerTxnImpl.h index 3c8852ad45..fcfe43e788 100644 --- a/src/ledger/LedgerTxnImpl.h +++ b/src/ledger/LedgerTxnImpl.h @@ -735,7 +735,7 @@ class LedgerTxnRoot::Impl mutable BestOffers mBestOffers; mutable uint64_t mPrefetchHits{0}; mutable uint64_t mPrefetchMisses{0}; - mutable std::unique_ptr + mutable std::shared_ptr mSearchableBucketListSnapshot{}; size_t mBulkLoadBatchSize; diff --git a/src/ledger/LedgerTxnLiquidityPoolSQL.cpp b/src/ledger/LedgerTxnLiquidityPoolSQL.cpp index 440b75dab0..ce8289b284 100644 --- a/src/ledger/LedgerTxnLiquidityPoolSQL.cpp +++ b/src/ledger/LedgerTxnLiquidityPoolSQL.cpp @@ -3,6 +3,7 @@ // of this distribution or at http://www.apache.org/licenses/LICENSE-2.0 #include "ledger/LedgerTxnImpl.h" +#include "ledger/LedgerTypeUtils.h" #include "ledger/NonSociRelatedException.h" #include "main/Application.h" #include "util/GlobalChecks.h" diff --git a/src/ledger/LedgerTxnOfferSQL.cpp b/src/ledger/LedgerTxnOfferSQL.cpp index e8b10c9936..6481bae9f7 100644 --- a/src/ledger/LedgerTxnOfferSQL.cpp +++ b/src/ledger/LedgerTxnOfferSQL.cpp @@ -7,6 +7,7 @@ #include "database/Database.h" #include "database/DatabaseTypeSpecificOperation.h" #include "ledger/LedgerTxnImpl.h" +#include "ledger/LedgerTypeUtils.h" #include "main/Application.h" #include "main/Config.h" #include "transactions/TransactionUtils.h" diff --git a/src/ledger/LedgerTxnTTLSQL.cpp b/src/ledger/LedgerTxnTTLSQL.cpp index abe5b44a0f..363923a14d 100644 --- a/src/ledger/LedgerTxnTTLSQL.cpp +++ b/src/ledger/LedgerTxnTTLSQL.cpp @@ -4,6 +4,7 @@ // of this distribution or at http://www.apache.org/licenses/LICENSE-2.0 #include "ledger/LedgerTxnImpl.h" +#include "ledger/LedgerTypeUtils.h" #include "ledger/NonSociRelatedException.h" #include "main/Application.h" #include "util/GlobalChecks.h" diff --git a/src/ledger/LedgerTxnTrustLineSQL.cpp b/src/ledger/LedgerTxnTrustLineSQL.cpp index 9d47d749e2..78631cd25a 100644 --- a/src/ledger/LedgerTxnTrustLineSQL.cpp +++ b/src/ledger/LedgerTxnTrustLineSQL.cpp @@ -7,6 +7,7 @@ #include "database/Database.h" #include "database/DatabaseTypeSpecificOperation.h" #include "ledger/LedgerTxnImpl.h" +#include "ledger/LedgerTypeUtils.h" #include "ledger/NonSociRelatedException.h" #include "main/Application.h" #include "util/GlobalChecks.h" diff --git a/src/ledger/LedgerTypeUtils.cpp b/src/ledger/LedgerTypeUtils.cpp index 54724793de..83740b582e 100644 --- a/src/ledger/LedgerTypeUtils.cpp +++ b/src/ledger/LedgerTypeUtils.cpp @@ -12,45 +12,6 @@ namespace stellar { -template -UnorderedMap> -populateLoadedEntries(KeySetT const& keys, - std::vector const& entries) -{ - UnorderedMap> res; - - for (auto const& le : entries) - { - auto key = LedgerEntryKey(le); - - // Abort if two entries for the same key appear. - releaseAssert(res.find(key) == res.end()); - - // Only return entries for keys that were actually requested. - if (keys.find(key) != keys.end()) - { - res.emplace(key, std::make_shared(le)); - } - } - - for (auto const& key : keys) - { - if (res.find(key) == res.end()) - { - res.emplace(key, nullptr); - } - } - return res; -} - -template UnorderedMap> -populateLoadedEntries(LedgerKeySet const& keys, - std::vector const& entries); - -template UnorderedMap> -populateLoadedEntries(UnorderedSet const& keys, - std::vector const& entries); - bool isLive(LedgerEntry const& e, uint32_t cutoffLedger) { diff --git a/src/ledger/LedgerTypeUtils.h b/src/ledger/LedgerTypeUtils.h index bf17230a09..336d030271 100644 --- a/src/ledger/LedgerTypeUtils.h +++ b/src/ledger/LedgerTypeUtils.h @@ -7,7 +7,9 @@ #include "ledger/LedgerHashUtils.h" #include "overlay/StellarXDR.h" #include "util/UnorderedMap.h" +#include "util/UnorderedSet.h" #include "util/XDROperators.h" +#include "util/types.h" namespace stellar { @@ -21,7 +23,33 @@ LedgerKey getTTLKey(LedgerKey const& e); template UnorderedMap> populateLoadedEntries(KeySetT const& keys, - std::vector const& entries); + std::vector const& entries) +{ + UnorderedMap> res; + + for (auto const& le : entries) + { + auto key = LedgerEntryKey(le); + + // Abort if two entries for the same key appear. + releaseAssert(res.find(key) == res.end()); + + // Only return entries for keys that were actually requested. + if (keys.find(key) != keys.end()) + { + res.emplace(key, std::make_shared(le)); + } + } + + for (auto const& key : keys) + { + if (res.find(key) == res.end()) + { + res.emplace(key, nullptr); + } + } + return res; +} template bool diff --git a/src/ledger/NetworkConfig.cpp b/src/ledger/NetworkConfig.cpp index 7d27e0d747..4047bd9899 100644 --- a/src/ledger/NetworkConfig.cpp +++ b/src/ledger/NetworkConfig.cpp @@ -7,6 +7,7 @@ #include "bucket/BucketManager.h" #include "main/Application.h" #include "util/ProtocolVersion.h" +#include #ifdef BUILD_TESTS #include "ledger/LedgerManager.h" diff --git a/src/main/ApplicationImpl.cpp b/src/main/ApplicationImpl.cpp index 62b7557ffb..14f37d6d83 100644 --- a/src/main/ApplicationImpl.cpp +++ b/src/main/ApplicationImpl.cpp @@ -17,6 +17,7 @@ #include "bucket/Bucket.h" #include "bucket/BucketManager.h" #include "catchup/ApplyBucketsWork.h" +#include "crypto/Hex.h" #include "crypto/SHA.h" #include "crypto/SecretKey.h" #include "database/Database.h" @@ -86,8 +87,8 @@ ApplicationImpl::ApplicationImpl(VirtualClock& clock, Config const& cfg) ? mConfig.WORKER_THREADS - 1 : mConfig.WORKER_THREADS) , mEvictionIOContext(mConfig.EXPERIMENTAL_BACKGROUND_EVICTION_SCAN - ? std::make_optional(1) - : std::nullopt) + ? std::make_unique(1) + : nullptr) , mWork(std::make_unique(mWorkerIOContext)) , mEvictionWork( mEvictionIOContext diff --git a/src/main/ApplicationImpl.h b/src/main/ApplicationImpl.h index a0f20f983b..301af06c0f 100644 --- a/src/main/ApplicationImpl.h +++ b/src/main/ApplicationImpl.h @@ -145,7 +145,7 @@ class ApplicationImpl : public Application // subsystems. asio::io_context mWorkerIOContext; - std::optional mEvictionIOContext; + std::unique_ptr mEvictionIOContext; std::unique_ptr mWork; std::unique_ptr mEvictionWork; diff --git a/src/main/ApplicationUtils.cpp b/src/main/ApplicationUtils.cpp index 423897d649..7338bbbac5 100644 --- a/src/main/ApplicationUtils.cpp +++ b/src/main/ApplicationUtils.cpp @@ -19,6 +19,7 @@ #include "invariant/BucketListIsConsistentWithDatabase.h" #include "ledger/LedgerHeaderUtils.h" #include "ledger/LedgerManager.h" +#include "ledger/LedgerTypeUtils.h" #include "main/ErrorMessages.h" #include "main/ExternalQueue.h" #include "main/Maintainer.h" diff --git a/src/main/CommandLine.cpp b/src/main/CommandLine.cpp index 92492c1b5e..1468880165 100644 --- a/src/main/CommandLine.cpp +++ b/src/main/CommandLine.cpp @@ -12,6 +12,7 @@ #include "catchup/CatchupConfiguration.h" #include "catchup/CatchupRange.h" #include "catchup/ReplayDebugMetaWork.h" +#include "crypto/SHA.h" #include "herder/Herder.h" #include "history/HistoryArchiveManager.h" #include "historywork/BatchDownloadWork.h" diff --git a/src/overlay/BanManagerImpl.cpp b/src/overlay/BanManagerImpl.cpp index d44ce7e970..a433ef94e0 100644 --- a/src/overlay/BanManagerImpl.cpp +++ b/src/overlay/BanManagerImpl.cpp @@ -4,7 +4,6 @@ #include "overlay/BanManagerImpl.h" #include "crypto/KeyUtils.h" -#include "crypto/SecretKey.h" #include "database/Database.h" #include "main/Application.h" #include "util/Logging.h" diff --git a/src/overlay/Floodgate.cpp b/src/overlay/Floodgate.cpp index 979160e6f2..cab199d17a 100644 --- a/src/overlay/Floodgate.cpp +++ b/src/overlay/Floodgate.cpp @@ -12,8 +12,6 @@ #include "overlay/OverlayManager.h" #include "util/GlobalChecks.h" #include "util/Logging.h" -#include "util/XDROperators.h" -#include "xdrpp/marshal.h" #include #include diff --git a/src/overlay/Floodgate.h b/src/overlay/Floodgate.h index a35141a82c..5eb5cbda77 100644 --- a/src/overlay/Floodgate.h +++ b/src/overlay/Floodgate.h @@ -5,7 +5,6 @@ // of this distribution or at http://www.apache.org/licenses/LICENSE-2.0 #include "overlay/Peer.h" -#include "overlay/StellarXDR.h" #include /** @@ -29,6 +28,8 @@ class Counter; namespace stellar { +struct StellarMessage; + class Floodgate { class FloodRecord diff --git a/src/overlay/FlowControl.cpp b/src/overlay/FlowControl.cpp index 988518e953..eaf0f80463 100644 --- a/src/overlay/FlowControl.cpp +++ b/src/overlay/FlowControl.cpp @@ -6,7 +6,6 @@ #include "herder/Herder.h" #include "main/Application.h" #include "medida/meter.h" -#include "medida/metrics_registry.h" #include "medida/timer.h" #include "overlay/OverlayManager.h" #include "overlay/OverlayMetrics.h" diff --git a/src/overlay/FlowControlCapacity.h b/src/overlay/FlowControlCapacity.h index 9c4cca6527..97e65592c5 100644 --- a/src/overlay/FlowControlCapacity.h +++ b/src/overlay/FlowControlCapacity.h @@ -5,12 +5,13 @@ // of this distribution or at http://www.apache.org/licenses/LICENSE-2.0 #include "main/Config.h" -#include "overlay/StellarXDR.h" #include namespace stellar { +struct StellarMessage; + class FlowControlCapacity { protected: diff --git a/src/overlay/ItemFetcher.cpp b/src/overlay/ItemFetcher.cpp index 99658e5226..f501c123c3 100644 --- a/src/overlay/ItemFetcher.cpp +++ b/src/overlay/ItemFetcher.cpp @@ -4,16 +4,11 @@ #include "overlay/ItemFetcher.h" #include "crypto/Hex.h" -#include "crypto/SHA.h" #include "herder/Herder.h" #include "herder/TxSetFrame.h" #include "main/Application.h" -#include "medida/metrics_registry.h" -#include "overlay/OverlayManager.h" -#include "overlay/StellarXDR.h" #include "overlay/Tracker.h" #include "util/Logging.h" -#include "xdrpp/marshal.h" #include namespace stellar diff --git a/src/overlay/ItemFetcher.h b/src/overlay/ItemFetcher.h index c35cebe019..63207d1290 100644 --- a/src/overlay/ItemFetcher.h +++ b/src/overlay/ItemFetcher.h @@ -5,13 +5,10 @@ // of this distribution or at http://www.apache.org/licenses/LICENSE-2.0 #include "overlay/Peer.h" -#include "util/HashOfHash.h" #include "util/NonCopyable.h" #include "util/Timer.h" -#include #include #include -#include namespace medida { diff --git a/src/overlay/OverlayAppConnector.h b/src/overlay/OverlayAppConnector.h index 23ff8f0a85..05160b489c 100644 --- a/src/overlay/OverlayAppConnector.h +++ b/src/overlay/OverlayAppConnector.h @@ -1,7 +1,6 @@ #pragma once #include "main/Config.h" -#include "util/GlobalChecks.h" namespace stellar { diff --git a/src/overlay/OverlayManager.h b/src/overlay/OverlayManager.h index fd3ebc13a2..a03f09aea0 100644 --- a/src/overlay/OverlayManager.h +++ b/src/overlay/OverlayManager.h @@ -5,7 +5,6 @@ // of this distribution or at http://www.apache.org/licenses/LICENSE-2.0 #include "overlay/Peer.h" -#include "overlay/StellarXDR.h" /** * OverlayManager maintains a virtual broadcast network, consisting of a set of @@ -50,6 +49,7 @@ class PeerAuth; class PeerBareAddress; class PeerManager; class SurveyManager; +struct StellarMessage; class OverlayManager { diff --git a/src/overlay/OverlayManagerImpl.cpp b/src/overlay/OverlayManagerImpl.cpp index 7116de956e..9d0d47d524 100644 --- a/src/overlay/OverlayManagerImpl.cpp +++ b/src/overlay/OverlayManagerImpl.cpp @@ -4,7 +4,6 @@ #include "overlay/OverlayManagerImpl.h" #include "crypto/Hex.h" -#include "crypto/KeyUtils.h" #include "crypto/SecretKey.h" #include "crypto/ShortHash.h" #include "database/Database.h" @@ -24,9 +23,7 @@ #include "util/GlobalChecks.h" #include "util/Logging.h" #include "util/Math.h" -#include "util/ProtocolVersion.h" #include "util/Thread.h" -#include "util/XDROperators.h" #include "xdrpp/marshal.h" #include #include @@ -36,7 +33,6 @@ #include "medida/metrics_registry.h" #include -#include namespace stellar { diff --git a/src/overlay/OverlayManagerImpl.h b/src/overlay/OverlayManagerImpl.h index 653ad1d109..fcddad728a 100644 --- a/src/overlay/OverlayManagerImpl.h +++ b/src/overlay/OverlayManagerImpl.h @@ -11,13 +11,10 @@ #include "herder/TxSetFrame.h" #include "ledger/LedgerTxn.h" #include "overlay/Floodgate.h" -#include "overlay/ItemFetcher.h" #include "overlay/OverlayManager.h" #include "overlay/OverlayMetrics.h" -#include "overlay/StellarXDR.h" #include "overlay/SurveyManager.h" #include "overlay/TxDemandsManager.h" -#include "util/Logging.h" #include "util/Timer.h" #include "medida/metrics_registry.h" diff --git a/src/overlay/OverlayMetrics.cpp b/src/overlay/OverlayMetrics.cpp index 8c884b7ee3..2f9a2e9b1b 100644 --- a/src/overlay/OverlayMetrics.cpp +++ b/src/overlay/OverlayMetrics.cpp @@ -1,9 +1,7 @@ #include "overlay/OverlayMetrics.h" #include "main/Application.h" -#include "medida/meter.h" #include "medida/metrics_registry.h" -#include "medida/timer.h" namespace stellar { diff --git a/src/overlay/Peer.cpp b/src/overlay/Peer.cpp index caad0d5964..d388fc2d2c 100644 --- a/src/overlay/Peer.cpp +++ b/src/overlay/Peer.cpp @@ -21,19 +21,15 @@ #include "overlay/OverlayMetrics.h" #include "overlay/PeerAuth.h" #include "overlay/PeerManager.h" -#include "overlay/StellarXDR.h" #include "overlay/SurveyManager.h" #include "overlay/TxAdverts.h" -#include "util/Decoder.h" #include "util/GlobalChecks.h" #include "util/Logging.h" #include "util/ProtocolVersion.h" -#include "util/XDROperators.h" #include "util/finally.h" #include "herder/HerderUtils.h" #include "medida/meter.h" -#include "medida/metrics_registry.h" #include "medida/timer.h" #include "xdrpp/marshal.h" #include @@ -57,18 +53,18 @@ static constexpr VirtualClock::time_point PING_NOT_SENT = Peer::Peer(Application& app, PeerRole role) : mAppConnector(app) , mNetworkID(app.getNetworkID()) + , mFlowControl(std::make_shared(mAppConnector)) , mLastRead(app.getClock().now()) , mLastWrite(app.getClock().now()) , mEnqueueTimeOfLastWrite(app.getClock().now()) , mRole(role) , mOverlayMetrics(app.getOverlayManager().getOverlayMetrics()) , mPeerMetrics(app.getClock().now()) - , mFlowControl(std::make_shared(mAppConnector)) + , mRecurringTimer(app) , mState(role == WE_CALLED_REMOTE ? CONNECTING : CONNECTED) , mRemoteOverlayMinVersion(0) , mRemoteOverlayVersion(std::nullopt) , mCreationTime(app.getClock().now()) - , mRecurringTimer(app) , mDelayedExecutionTimer(app) , mTxAdverts(std::make_shared(app)) { diff --git a/src/overlay/Peer.h b/src/overlay/Peer.h index d731b3c376..1857b002e8 100644 --- a/src/overlay/Peer.h +++ b/src/overlay/Peer.h @@ -4,15 +4,13 @@ // under the Apache License, Version 2.0. See the COPYING file at the root // of this distribution or at http://www.apache.org/licenses/LICENSE-2.0 -#include "util/asio.h" +#include "util/asio.h" // IWYU pragma: keep #include "database/Database.h" #include "lib/json/json.h" #include "medida/timer.h" #include "overlay/OverlayAppConnector.h" #include "overlay/PeerBareAddress.h" -#include "overlay/StellarXDR.h" #include "util/NonCopyable.h" -#include "util/RandomEvictionCache.h" #include "util/Timer.h" #include "xdrpp/message.h" diff --git a/src/overlay/PeerAuth.cpp b/src/overlay/PeerAuth.cpp index edc5392ba9..ff4e6fcbdc 100644 --- a/src/overlay/PeerAuth.cpp +++ b/src/overlay/PeerAuth.cpp @@ -10,7 +10,6 @@ #include "main/Application.h" #include "main/Config.h" #include "util/Logging.h" -#include "util/XDROperators.h" #include "xdrpp/marshal.h" namespace stellar diff --git a/src/overlay/PeerAuth.h b/src/overlay/PeerAuth.h index 011e9a9a2d..576ff67248 100644 --- a/src/overlay/PeerAuth.h +++ b/src/overlay/PeerAuth.h @@ -1,6 +1,5 @@ #pragma once -#include "crypto/Curve25519.h" #include "overlay/Peer.h" #include "overlay/PeerSharedKeyId.h" #include "util/RandomEvictionCache.h" diff --git a/src/overlay/PeerBareAddress.cpp b/src/overlay/PeerBareAddress.cpp index de59187334..41bb3f75f7 100644 --- a/src/overlay/PeerBareAddress.cpp +++ b/src/overlay/PeerBareAddress.cpp @@ -2,7 +2,6 @@ // under the Apache License, Version 2.0. See the COPYING file at the root // of this distribution or at http://www.apache.org/licenses/LICENSE-2.0 -#include "util/asio.h" #include "overlay/PeerBareAddress.h" #include "main/Application.h" #include "util/GlobalChecks.h" @@ -10,7 +9,6 @@ #include #include -#include namespace stellar { diff --git a/src/overlay/PeerDoor.cpp b/src/overlay/PeerDoor.cpp index 4c2aacfda5..742510bb1a 100644 --- a/src/overlay/PeerDoor.cpp +++ b/src/overlay/PeerDoor.cpp @@ -46,7 +46,7 @@ PeerDoor::close() { asio::error_code ec; // ignore errors when closing - mAcceptor.close(ec); + std::ignore = mAcceptor.close(ec); } } @@ -82,7 +82,7 @@ PeerDoor::handleKnock(shared_ptr socket) if (!peer) { asio::error_code ec; - socket->close(ec); + std::ignore = socket->close(ec); if (ec) { CLOG_WARNING(Overlay, "TCPPeer: close socket failed: {}", diff --git a/src/overlay/PeerDoor.h b/src/overlay/PeerDoor.h index 9301a5bb7a..1864350994 100644 --- a/src/overlay/PeerDoor.h +++ b/src/overlay/PeerDoor.h @@ -4,7 +4,7 @@ // under the Apache License, Version 2.0. See the COPYING file at the root // of this distribution or at http://www.apache.org/licenses/LICENSE-2.0 -#include "util/asio.h" +#include "util/asio.h" // IWYU pragma: keep #include "TCPPeer.h" #include diff --git a/src/overlay/PeerManager.cpp b/src/overlay/PeerManager.cpp index 701a3bb24d..4abfbc946c 100644 --- a/src/overlay/PeerManager.cpp +++ b/src/overlay/PeerManager.cpp @@ -3,16 +3,13 @@ // of this distribution or at http://www.apache.org/licenses/LICENSE-2.0 #include "overlay/PeerManager.h" -#include "crypto/Random.h" #include "database/Database.h" #include "lib/util/stdrandom.h" #include "main/Application.h" #include "overlay/RandomPeerSource.h" -#include "overlay/StellarXDR.h" #include "util/GlobalChecks.h" #include "util/Logging.h" #include "util/Math.h" -#include "util/must_use.h" #include #include diff --git a/src/overlay/RandomPeerSource.cpp b/src/overlay/RandomPeerSource.cpp index 18d0c58b5b..497cd45b3d 100644 --- a/src/overlay/RandomPeerSource.cpp +++ b/src/overlay/RandomPeerSource.cpp @@ -3,20 +3,6 @@ // of this distribution or at http://www.apache.org/licenses/LICENSE-2.0 #include "overlay/RandomPeerSource.h" -#include "crypto/Random.h" -#include "database/Database.h" -#include "main/Application.h" -#include "overlay/StellarXDR.h" -#include "util/GlobalChecks.h" -#include "util/Logging.h" -#include "util/Math.h" -#include "util/must_use.h" - -#include -#include -#include -#include -#include #include namespace stellar diff --git a/src/overlay/SurveyManager.cpp b/src/overlay/SurveyManager.cpp index 13b16cce6a..6aed400a68 100644 --- a/src/overlay/SurveyManager.cpp +++ b/src/overlay/SurveyManager.cpp @@ -3,6 +3,7 @@ // of this distribution or at http://www.apache.org/licenses/LICENSE-2.0 #include "SurveyManager.h" +#include "crypto/Curve25519.h" #include "herder/Herder.h" #include "main/Application.h" #include "main/ErrorMessages.h" diff --git a/src/overlay/SurveyManager.h b/src/overlay/SurveyManager.h index b8ae498d02..1aecd91bba 100644 --- a/src/overlay/SurveyManager.h +++ b/src/overlay/SurveyManager.h @@ -4,9 +4,7 @@ // under the Apache License, Version 2.0. See the COPYING file at the root // of this distribution or at http://www.apache.org/licenses/LICENSE-2.0 -#include "crypto/Curve25519.h" #include "overlay/Peer.h" -#include "overlay/StellarXDR.h" #include "overlay/SurveyMessageLimiter.h" #include "util/Timer.h" #include "util/UnorderedSet.h" diff --git a/src/overlay/SurveyMessageLimiter.h b/src/overlay/SurveyMessageLimiter.h index 07487cf6db..7ddc350a1b 100644 --- a/src/overlay/SurveyMessageLimiter.h +++ b/src/overlay/SurveyMessageLimiter.h @@ -4,7 +4,7 @@ // under the Apache License, Version 2.0. See the COPYING file at the root // of this distribution or at http://www.apache.org/licenses/LICENSE-2.0 -#include "overlay/StellarXDR.h" +#include "overlay/StellarXDR.h" // IWYU pragma: keep #include "util/UnorderedMap.h" #include #include diff --git a/src/overlay/TCPPeer.cpp b/src/overlay/TCPPeer.cpp index 979068f22b..4357743ae8 100644 --- a/src/overlay/TCPPeer.cpp +++ b/src/overlay/TCPPeer.cpp @@ -4,18 +4,14 @@ #include "overlay/TCPPeer.h" #include "crypto/CryptoError.h" -#include "crypto/Curve25519.h" #include "database/Database.h" #include "main/Application.h" #include "main/Config.h" #include "main/ErrorMessages.h" #include "medida/meter.h" -#include "medida/metrics_registry.h" #include "overlay/FlowControl.h" #include "overlay/OverlayManager.h" #include "overlay/OverlayMetrics.h" -#include "overlay/PeerManager.h" -#include "overlay/StellarXDR.h" #include "util/GlobalChecks.h" #include "util/LogSlowExecution.h" #include "util/Logging.h" @@ -73,8 +69,10 @@ TCPPeer::initiate(Application& app, PeerBareAddress const& address) { asio::ip::tcp::no_delay nodelay(true); asio::ip::tcp::socket::linger linger(false, 0); - result->mSocket->next_layer().set_option(nodelay, ec); - result->mSocket->next_layer().set_option(linger, lingerEc); + std::ignore = + result->mSocket->next_layer().set_option(nodelay, ec); + std::ignore = + result->mSocket->next_layer().set_option(linger, lingerEc); } else { @@ -130,8 +128,8 @@ TCPPeer::accept(Application& app, shared_ptr socket) asio::ip::tcp::no_delay nodelay(true); asio::ip::tcp::socket::linger linger(false, 0); - socket->next_layer().set_option(nodelay, ec); - socket->next_layer().set_option(linger, lingerEc); + std::ignore = socket->next_layer().set_option(nodelay, ec); + std::ignore = socket->next_layer().set_option(linger, lingerEc); if (!ec && !lingerEc) { @@ -166,9 +164,9 @@ TCPPeer::~TCPPeer() #ifndef _WIN32 // This always fails on windows and ASIO won't // even build it. - mSocket->next_layer().cancel(ec); + std::ignore = mSocket->next_layer().cancel(ec); #endif - mSocket->close(ec); + std::ignore = mSocket->close(ec); } } @@ -228,7 +226,7 @@ TCPPeer::shutdown() // done with it, but we want to give some chance of telling peers // why we're disconnecting them. asio::error_code ec; - self->mSocket->next_layer().shutdown( + std::ignore = self->mSocket->next_layer().shutdown( asio::ip::tcp::socket::shutdown_both, ec); if (ec) { @@ -247,7 +245,7 @@ TCPPeer::shutdown() // read/write handlers, i.e. fire them with an error code // indicating cancellation. asio::error_code ec2; - self->mSocket->close(ec2); + std::ignore = self->mSocket->close(ec2); if (ec2) { CLOG_DEBUG(Overlay, "TCPPeer::drop close socket failed: {}", diff --git a/src/overlay/Tracker.cpp b/src/overlay/Tracker.cpp index 7cad0e2268..5e2bdc3c03 100644 --- a/src/overlay/Tracker.cpp +++ b/src/overlay/Tracker.cpp @@ -9,13 +9,11 @@ #include "crypto/Hex.h" #include "herder/Herder.h" #include "main/Application.h" -#include "medida/medida.h" +#include "medida/meter.h" #include "overlay/OverlayManager.h" #include "util/GlobalChecks.h" #include "util/Logging.h" #include "util/Math.h" -#include "util/XDROperators.h" -#include "xdrpp/marshal.h" #include namespace stellar diff --git a/src/overlay/TxAdverts.cpp b/src/overlay/TxAdverts.cpp index 3b5f562e72..ce36a50e8f 100644 --- a/src/overlay/TxAdverts.cpp +++ b/src/overlay/TxAdverts.cpp @@ -3,10 +3,8 @@ // of this distribution or at http://www.apache.org/licenses/LICENSE-2.0 #include "overlay/TxAdverts.h" -#include "crypto/Hex.h" #include "ledger/LedgerManager.h" #include "main/Application.h" -#include "util/Logging.h" #include "util/ProtocolVersion.h" #include diff --git a/src/overlay/TxAdverts.h b/src/overlay/TxAdverts.h index bb01722530..32dc8cef79 100644 --- a/src/overlay/TxAdverts.h +++ b/src/overlay/TxAdverts.h @@ -4,7 +4,7 @@ // under the Apache License, Version 2.0. See the COPYING file at the root // of this distribution or at http://www.apache.org/licenses/LICENSE-2.0 -#include "util/HashOfHash.h" +#include "util/HashOfHash.h" // IWYU pragma: keep #include "util/RandomEvictionCache.h" #include "xdr/Stellar-overlay.h" #include diff --git a/src/overlay/TxDemandsManager.cpp b/src/overlay/TxDemandsManager.cpp index 34fa393c18..527e0c28d6 100644 --- a/src/overlay/TxDemandsManager.cpp +++ b/src/overlay/TxDemandsManager.cpp @@ -5,7 +5,6 @@ #include "overlay/TxDemandsManager.h" #include "crypto/Hex.h" #include "herder/Herder.h" -#include "ledger/LedgerManager.h" #include "medida/meter.h" #include "overlay/OverlayManager.h" #include "overlay/OverlayMetrics.h" diff --git a/src/test/TxTests.cpp b/src/test/TxTests.cpp index 73e7a41fe2..f806cf5720 100644 --- a/src/test/TxTests.cpp +++ b/src/test/TxTests.cpp @@ -11,6 +11,7 @@ #include "ledger/LedgerTxn.h" #include "ledger/LedgerTxnEntry.h" #include "ledger/LedgerTxnHeader.h" +#include "ledger/LedgerTypeUtils.h" #include "ledger/TrustLineWrapper.h" #include "ledger/test/LedgerTestUtils.h" #include "main/Application.h" diff --git a/src/transactions/ExtendFootprintTTLOpFrame.cpp b/src/transactions/ExtendFootprintTTLOpFrame.cpp index 6941f5dfc3..648526b69a 100644 --- a/src/transactions/ExtendFootprintTTLOpFrame.cpp +++ b/src/transactions/ExtendFootprintTTLOpFrame.cpp @@ -5,6 +5,7 @@ #include "transactions/ExtendFootprintTTLOpFrame.h" #include "TransactionUtils.h" #include "ledger/LedgerManagerImpl.h" +#include "ledger/LedgerTypeUtils.h" #include namespace stellar diff --git a/src/transactions/InvokeHostFunctionOpFrame.cpp b/src/transactions/InvokeHostFunctionOpFrame.cpp index 38c7a56cbd..38177ec16a 100644 --- a/src/transactions/InvokeHostFunctionOpFrame.cpp +++ b/src/transactions/InvokeHostFunctionOpFrame.cpp @@ -24,6 +24,7 @@ #include "ledger/LedgerManagerImpl.h" #include "ledger/LedgerTxn.h" #include "ledger/LedgerTxnEntry.h" +#include "ledger/LedgerTypeUtils.h" #include "rust/RustBridge.h" #include "transactions/InvokeHostFunctionOpFrame.h" #include diff --git a/src/transactions/RestoreFootprintOpFrame.cpp b/src/transactions/RestoreFootprintOpFrame.cpp index bd0efbbfd1..68fe3a23db 100644 --- a/src/transactions/RestoreFootprintOpFrame.cpp +++ b/src/transactions/RestoreFootprintOpFrame.cpp @@ -5,6 +5,7 @@ #include "transactions/RestoreFootprintOpFrame.h" #include "TransactionUtils.h" #include "ledger/LedgerManagerImpl.h" +#include "ledger/LedgerTypeUtils.h" #include namespace stellar diff --git a/src/transactions/test/InvokeHostFunctionTests.cpp b/src/transactions/test/InvokeHostFunctionTests.cpp index 0b678107a5..2c1e6caf10 100644 --- a/src/transactions/test/InvokeHostFunctionTests.cpp +++ b/src/transactions/test/InvokeHostFunctionTests.cpp @@ -13,6 +13,7 @@ #include "herder/Herder.h" #include "ledger/LedgerManager.h" #include "ledger/LedgerTxn.h" +#include "ledger/LedgerTypeUtils.h" #include "ledger/test/LedgerTestUtils.h" #include "lib/catch.hpp" #include "main/Application.h" @@ -4146,9 +4147,6 @@ TEST_CASE("Module cache", "[tx][soroban]") auto const& sumContract = test.deployWasmContract(sum_wasm); auto const& addContract = test.deployWasmContract(add_wasm); - auto const& sumWasmHash = sumContract.getKeys().front().contractCode().hash; - auto const& addWasmHash = addContract.getKeys().front().contractCode().hash; - auto invocation = [&](int64_t instructions) -> bool { auto fnName = "sum"; auto scVec = makeVecSCVal({makeI32(1), makeI32(2), makeI32(3), diff --git a/src/transactions/test/SorobanTxTestUtils.cpp b/src/transactions/test/SorobanTxTestUtils.cpp index b4a7c8e408..44928b9521 100644 --- a/src/transactions/test/SorobanTxTestUtils.cpp +++ b/src/transactions/test/SorobanTxTestUtils.cpp @@ -3,6 +3,7 @@ // of this distribution or at http://www.apache.org/licenses/LICENSE-2.0 #include "SorobanTxTestUtils.h" +#include "ledger/LedgerTypeUtils.h" #include "lib/catch.hpp" #include "rust/RustBridge.h" #include "test/TestAccount.h" diff --git a/src/util/XDRStream.h b/src/util/XDRStream.h index b9337dac19..517ebc72a2 100644 --- a/src/util/XDRStream.h +++ b/src/util/XDRStream.h @@ -14,6 +14,7 @@ #include "xdrpp/marshal.h" #include +#include #include #include #include @@ -66,6 +67,12 @@ class XDRInputFileStream mSize = fs::size(mIn); } + void + open(std::filesystem::path const& filename) + { + open(filename.string()); + } + operator bool() const { return mIn.good(); diff --git a/src/util/types.h b/src/util/types.h index b747e85430..0a893c5a1e 100644 --- a/src/util/types.h +++ b/src/util/types.h @@ -5,11 +5,10 @@ // of this distribution or at http://www.apache.org/licenses/LICENSE-2.0 #include "bucket/LedgerCmp.h" -#include "numeric.h" -#include "overlay/StellarXDR.h" -#include "xdrpp/message.h" +#include "xdr/Stellar-ledger-entries.h" +#include "xdr/Stellar-ledger.h" +#include "xdr/Stellar-types.h" #include -#include #include namespace stellar