From ea40f2e7826ca467cf99b96961ba58c3b7ab5e02 Mon Sep 17 00:00:00 2001 From: anupsdf Date: Thu, 11 Dec 2025 14:42:48 -0800 Subject: [PATCH] Remove deprecated Clang-Format style options and improve readability --- .clang-format | 21 +++++++++---------- src/bucket/BucketListBase.cpp | 1 - src/bucket/BucketManager.cpp | 3 --- src/bucket/BucketOutputIterator.cpp | 1 - src/bucket/BucketSnapshot.cpp | 1 - src/bucket/LiveBucketIndex.cpp | 1 - src/bucket/SearchableBucketList.cpp | 1 - src/bucket/test/BucketIndexTests.cpp | 1 - src/bucket/test/BucketManagerTests.cpp | 1 - src/crypto/SecretKey.cpp | 1 - src/database/test/DatabaseTests.cpp | 1 - src/herder/Herder.cpp | 1 - src/herder/HerderPersistenceImpl.h | 1 - src/herder/HerderSCPDriver.cpp | 4 ---- src/herder/QuorumIntersectionCheckerImpl.cpp | 1 - src/herder/QuorumIntersectionCheckerImpl.h | 2 -- src/herder/TxSetFrame.cpp | 4 ---- src/herder/test/HerderTests.cpp | 3 --- src/herder/test/TxSetTests.cpp | 3 --- src/herder/test/UpgradesTests.cpp | 1 - .../test/OrderBookIsNotCrossedTests.cpp | 1 - src/ledger/LedgerManager.h | 1 - src/ledger/LedgerTxn.cpp | 1 - src/ledger/LedgerTxnOfferSQL.cpp | 1 - src/ledger/NetworkConfig.h | 1 - src/ledger/test/LedgerTestUtils.cpp | 2 -- src/main/CommandHandler.cpp | 2 -- src/main/Config.cpp | 1 - src/main/Config.h | 1 - src/main/SettingsUpgradeUtils.cpp | 1 - src/main/main.cpp | 1 - src/overlay/Peer.h | 1 - src/overlay/test/OverlayManagerTests.cpp | 1 - src/protocol-curr/xdr | 2 +- src/rust/soroban/p25 | 2 +- src/scp/BallotProtocol.cpp | 1 - src/scp/Slot.cpp | 1 - src/scp/test/SCPTests.cpp | 1 - src/scp/test/SCPUnitTests.cpp | 1 - src/simulation/ApplyLoad.cpp | 1 - src/simulation/LoadGenerator.cpp | 2 -- src/simulation/Simulation.cpp | 1 - src/simulation/Simulation.h | 1 - src/simulation/Topologies.cpp | 1 - src/test/TestAccount.cpp | 1 - src/test/TestMarket.cpp | 1 - .../ExtendFootprintTTLOpFrame.cpp | 1 - src/transactions/ExtendFootprintTTLOpFrame.h | 1 - .../InvokeHostFunctionOpFrame.cpp | 1 - src/transactions/ManageDataOpFrame.h | 1 - src/transactions/ParallelApplyStage.cpp | 1 - src/transactions/ParallelApplyUtils.h | 2 -- src/transactions/RestoreFootprintOpFrame.cpp | 2 -- src/transactions/SetTrustLineFlagsOpFrame.cpp | 1 - src/transactions/TransactionMeta.cpp | 1 - src/transactions/TransactionUtils.cpp | 1 - src/transactions/test/AllowTrustTests.cpp | 1 - .../test/InvokeHostFunctionTests.cpp | 7 ------- src/transactions/test/SorobanTxTestUtils.cpp | 2 -- src/transactions/test/TxEnvelopeTests.cpp | 1 - src/util/NonCopyable.h | 3 ++- src/util/TxResource.cpp | 1 - src/util/test/BinaryFuseTests.cpp | 1 - src/util/test/MetricTests.cpp | 1 - 64 files changed, 14 insertions(+), 99 deletions(-) diff --git a/.clang-format b/.clang-format index 043b98792b..f155027cb3 100644 --- a/.clang-format +++ b/.clang-format @@ -14,9 +14,7 @@ AllowShortCaseLabelsOnASingleLine: false AllowShortFunctionsOnASingleLine: None AllowShortIfStatementsOnASingleLine: false AllowShortLoopsOnASingleLine: false -AlwaysBreakAfterReturnType: AllDefinitions AlwaysBreakBeforeMultilineStrings: false -AlwaysBreakTemplateDeclarations: false BinPackArguments: true BinPackParameters: true BraceWrapping: @@ -38,18 +36,17 @@ BraceWrapping: SplitEmptyFunction: true SplitEmptyRecord: true SplitEmptyNamespace: true +BreakAfterReturnType: AllDefinitions BreakBeforeBinaryOperators: None BreakBeforeBraces: Custom -BreakBeforeInheritanceComma: false BreakBeforeTernaryOperators: true -BreakConstructorInitializersBeforeComma: true BreakConstructorInitializers: BeforeComma -BreakAfterJavaFieldAnnotations: false +BreakInheritanceList: AfterComma BreakStringLiterals: true +BreakTemplateDeclarations: Leave ColumnLimit: 80 CommentPragmas: '^ IWYU pragma:' CompactNamespaces: false -ConstructorInitializerAllOnOneLineOrOnePerLine: true ConstructorInitializerIndentWidth: 4 ContinuationIndentWidth: 4 Cpp11BracedListStyle: true @@ -78,7 +75,10 @@ IndentWidth: 4 IndentWrappedFunctionNames: false JavaScriptQuotes: Leave JavaScriptWrapImports: true -KeepEmptyLinesAtTheStartOfBlocks: true +KeepEmptyLines: + AtStartOfBlock: false + AtStartOfFile: false + AtEndOfFile: false MacroBlockBegin: '' MacroBlockEnd: '' MaxEmptyLinesToKeep: 1 @@ -86,6 +86,7 @@ NamespaceIndentation: None ObjCBlockIndentWidth: 2 ObjCSpaceAfterProperty: false ObjCSpaceBeforeProtocolList: true +PackConstructorInitializers: NextLine PenaltyBreakAssignment: 2 PenaltyBreakBeforeFirstCallParameter: 19 PenaltyBreakComment: 300 @@ -101,14 +102,12 @@ SpaceAfterCStyleCast: false SpaceAfterTemplateKeyword: true SpaceBeforeAssignmentOperators: true SpaceBeforeParens: ControlStatements -SpaceInEmptyParentheses: false SpacesBeforeTrailingComments: 1 SpacesInAngles: false SpacesInContainerLiterals: true -SpacesInCStyleCastParentheses: false -SpacesInParentheses: false +SpacesInParens: Never SpacesInSquareBrackets: false -Standard: Cpp11 +Standard: c++17 TabWidth: 8 UseTab: Never UseCRLF: false diff --git a/src/bucket/BucketListBase.cpp b/src/bucket/BucketListBase.cpp index 55dad3fe7f..84f33b18a9 100644 --- a/src/bucket/BucketListBase.cpp +++ b/src/bucket/BucketListBase.cpp @@ -111,7 +111,6 @@ bool BucketListBase::shouldMergeWithEmptyCurr(uint32_t ledger, uint32_t level) { - if (level != 0) { // Round down the current ledger to when the merge was started, and diff --git a/src/bucket/BucketManager.cpp b/src/bucket/BucketManager.cpp index c90d80e4b2..91ebbe7ee9 100644 --- a/src/bucket/BucketManager.cpp +++ b/src/bucket/BucketManager.cpp @@ -259,7 +259,6 @@ BucketManager::getBucketDir() const BucketManager::~BucketManager() { - deleteTmpDirAndUnlockBucketDir(); } @@ -1291,7 +1290,6 @@ BucketManager::resolveBackgroundEvictionScan( void BucketManager::calculateSkipValues(LedgerHeader& currentHeader) { - if ((currentHeader.ledgerSeq % SKIP_1) == 0) { int v = currentHeader.ledgerSeq - SKIP_1; @@ -1303,7 +1301,6 @@ BucketManager::calculateSkipValues(LedgerHeader& currentHeader) v = currentHeader.ledgerSeq - SKIP_3 - SKIP_2 - SKIP_1; if (v > 0 && (v % SKIP_4) == 0) { - currentHeader.skipList[3] = currentHeader.skipList[2]; } currentHeader.skipList[2] = currentHeader.skipList[1]; diff --git a/src/bucket/BucketOutputIterator.cpp b/src/bucket/BucketOutputIterator.cpp index 7402e2bc00..8841c9bc37 100644 --- a/src/bucket/BucketOutputIterator.cpp +++ b/src/bucket/BucketOutputIterator.cpp @@ -46,7 +46,6 @@ BucketOutputIterator::BucketOutputIterator(std::string const& tmpDir, meta.ledgerVersion, LiveBucket::FIRST_PROTOCOL_SUPPORTING_INITENTRY_AND_METAENTRY)) { - if constexpr (std::is_same_v) { BucketEntry bme; diff --git a/src/bucket/BucketSnapshot.cpp b/src/bucket/BucketSnapshot.cpp index 22e660852d..523607bead 100644 --- a/src/bucket/BucketSnapshot.cpp +++ b/src/bucket/BucketSnapshot.cpp @@ -130,7 +130,6 @@ BucketSnapshotBase::loadKeys( std::shared_ptr entryOp; switch (indexRes.getState()) { - // Index had entry in cache case IndexReturnState::CACHE_HIT: if constexpr (std::is_same_v) diff --git a/src/bucket/LiveBucketIndex.cpp b/src/bucket/LiveBucketIndex.cpp index 5a399e0881..98b30567a6 100644 --- a/src/bucket/LiveBucketIndex.cpp +++ b/src/bucket/LiveBucketIndex.cpp @@ -51,7 +51,6 @@ LiveBucketIndex::LiveBucketIndex(BucketManager& bm, auto pageSize = getPageSize(bm.getConfig(), fs::size(filename.string())); if (pageSize == 0) { - CLOG_DEBUG(Bucket, "LiveBucketIndex::createIndex() using in-memory index for " "bucket {}", diff --git a/src/bucket/SearchableBucketList.cpp b/src/bucket/SearchableBucketList.cpp index 7df098586d..94db308b60 100644 --- a/src/bucket/SearchableBucketList.cpp +++ b/src/bucket/SearchableBucketList.cpp @@ -195,7 +195,6 @@ SearchableLiveBucketListSnapshot::loadInflationWinners(size_t maxWinners, // Check if we need to sort the voteCount by number of votes if (voteCount.size() > maxWinners) { - // Sort Inflation winners by vote count in descending order std::map::const_iterator, std::greater> diff --git a/src/bucket/test/BucketIndexTests.cpp b/src/bucket/test/BucketIndexTests.cpp index 4baf252286..aaa62328c7 100644 --- a/src/bucket/test/BucketIndexTests.cpp +++ b/src/bucket/test/BucketIndexTests.cpp @@ -89,7 +89,6 @@ class BucketIndexTest } else if (sorobanOnly) { - entries = LedgerTestUtils::generateValidUniqueLedgerEntriesWithTypes( {CONTRACT_DATA, CONTRACT_CODE}, 10, mGeneratedKeys); diff --git a/src/bucket/test/BucketManagerTests.cpp b/src/bucket/test/BucketManagerTests.cpp index b9f52702b1..d151255a91 100644 --- a/src/bucket/test/BucketManagerTests.cpp +++ b/src/bucket/test/BucketManagerTests.cpp @@ -46,7 +46,6 @@ namespace BucketManagerTests static void clearFutures(Application::pointer app, LiveBucketList& bl) { - // First go through the BL and mop up all the FutureBuckets. for (uint32_t i = 0; i < LiveBucketList::kNumLevels; ++i) { diff --git a/src/crypto/SecretKey.cpp b/src/crypto/SecretKey.cpp index 1c92d1c090..aee591db58 100644 --- a/src/crypto/SecretKey.cpp +++ b/src/crypto/SecretKey.cpp @@ -531,7 +531,6 @@ logSecretKey(std::ostream& s, SecretKey const& sk) void StrKeyUtils::logKey(std::ostream& s, std::string const& key) { - // see if it's a public key try { diff --git a/src/database/test/DatabaseTests.cpp b/src/database/test/DatabaseTests.cpp index faca04ddc0..264c0676d4 100644 --- a/src/database/test/DatabaseTests.cpp +++ b/src/database/test/DatabaseTests.cpp @@ -91,7 +91,6 @@ TEST_CASE("database on-disk smoketest", "[db]") void checkMVCCIsolation(Application::pointer app) { - int v0 = 1; // Values we insert/update in different txs diff --git a/src/herder/Herder.cpp b/src/herder/Herder.cpp index 5a7f6c859c..8587786573 100644 --- a/src/herder/Herder.cpp +++ b/src/herder/Herder.cpp @@ -1,4 +1,3 @@ - #include "herder/Herder.h" namespace stellar diff --git a/src/herder/HerderPersistenceImpl.h b/src/herder/HerderPersistenceImpl.h index 968d66bb1a..3b953eb319 100644 --- a/src/herder/HerderPersistenceImpl.h +++ b/src/herder/HerderPersistenceImpl.h @@ -12,7 +12,6 @@ class Application; class HerderPersistenceImpl : public HerderPersistence { - public: HerderPersistenceImpl(Application& app); ~HerderPersistenceImpl(); diff --git a/src/herder/HerderSCPDriver.cpp b/src/herder/HerderSCPDriver.cpp index dba60cea98..ba9339f57c 100644 --- a/src/herder/HerderSCPDriver.cpp +++ b/src/herder/HerderSCPDriver.cpp @@ -552,7 +552,6 @@ HerderSCPDriver::setupTimer(uint64_t slotIndex, int timerID, void HerderSCPDriver::stopTimer(uint64 slotIndex, int timerID) { - auto timersIt = mSCPTimers.find(slotIndex); if (timersIt == mSCPTimers.end()) { @@ -764,7 +763,6 @@ HerderSCPDriver::combineCandidates(uint64_t slotIndex, releaseAssert(cApplicableTxSet); if (cTxSet->previousLedgerHash() == lcl.hash) { - if (!highestTxSet || compareTxSets(*highestApplicableTxSet, *cApplicableTxSet, highest->txSetHash, sv.txSetHash, @@ -1082,7 +1080,6 @@ HerderSCPDriver::getExternalizeLag(NodeID const& id) const void HerderSCPDriver::recordSCPEvent(uint64_t slotIndex, bool isNomination) { - auto& timing = mSCPExecutionTimes[slotIndex]; VirtualClock::time_point start = mApp.getClock().now(); @@ -1385,7 +1382,6 @@ size_t HerderSCPDriver::TxSetValidityKeyHash::operator()( TxSetValidityKey const& key) const { - size_t res = std::hash()(std::get<0>(key)); hashMix(res, std::hash()(std::get<1>(key))); hashMix(res, std::get<2>(key)); diff --git a/src/herder/QuorumIntersectionCheckerImpl.cpp b/src/herder/QuorumIntersectionCheckerImpl.cpp index ee8b3226dd..994edc1186 100644 --- a/src/herder/QuorumIntersectionCheckerImpl.cpp +++ b/src/herder/QuorumIntersectionCheckerImpl.cpp @@ -71,7 +71,6 @@ MinQuorumEnumerator::pickSplitNode( size_t maxDegree = 0; for (size_t i = 0; mRemaining.nextSet(i); ++i) { - // Heuristic opportunity: biasing towards cross-org edges and // away from intra-org edges seems to help; work out some way // to make this a robust bias. diff --git a/src/herder/QuorumIntersectionCheckerImpl.h b/src/herder/QuorumIntersectionCheckerImpl.h index 24341e17d1..1bc6ebea1e 100644 --- a/src/herder/QuorumIntersectionCheckerImpl.h +++ b/src/herder/QuorumIntersectionCheckerImpl.h @@ -401,7 +401,6 @@ struct QBitSet // recursive cases. class MinQuorumEnumerator { - // Set of nodes "committed to" in this branch of the recurrence. In other // words: set of nodes that this enumerator and its children will definitely // include in every subset S of the powerset that they examine. This set @@ -449,7 +448,6 @@ class MinQuorumEnumerator // MinQuorumEnumerator to recursively scan the powerset. class QuorumIntersectionCheckerImpl : public stellar::QuorumIntersectionChecker { - std::optional const mCfg; struct Stats diff --git a/src/herder/TxSetFrame.cpp b/src/herder/TxSetFrame.cpp index 248cfbed80..73e0c5508f 100644 --- a/src/herder/TxSetFrame.cpp +++ b/src/herder/TxSetFrame.cpp @@ -729,7 +729,6 @@ checkFeeMap(InclusionFeeMap const& feeMap, LedgerHeader const& lclHeader) } if (*fee < lclHeader.baseFee) { - CLOG_DEBUG(Herder, "Got bad txSet: {} has too low component " "base fee {}", @@ -1361,7 +1360,6 @@ TxSetPhaseFrame::Iterator::Iterator(TxStageFrameList const& txs, TransactionFrameBasePtr TxSetPhaseFrame::Iterator::operator*() const { - if (mStageIndex >= mStages.size() || mClusterIndex >= mStages[mStageIndex].size() || mTxIndex >= mStages[mStageIndex][mClusterIndex].size()) @@ -1674,7 +1672,6 @@ TxSetPhaseFrame::getSequentialTxs() const void TxSetPhaseFrame::toXDR(TransactionPhase& xdrPhase) const { - if (isParallel()) { parallelPhaseToXdr(mStages, *mInclusionFeeMap, xdrPhase); @@ -1967,7 +1964,6 @@ TxSetPhaseFrame::txsAreValid(Application& app, upperBoundCloseTimeOffset, diagnostics); if (!txResult->isSuccess()) { - CLOG_DEBUG( Herder, "Got bad txSet: tx invalid tx: {} result: {}", xdrToCerealString(tx->getEnvelope(), "TransactionEnvelope"), diff --git a/src/herder/test/HerderTests.cpp b/src/herder/test/HerderTests.cpp index e47782a97e..2cfd19b77e 100644 --- a/src/herder/test/HerderTests.cpp +++ b/src/herder/test/HerderTests.cpp @@ -3148,7 +3148,6 @@ TEST_CASE("soroban txs each parameter surge priced", "[soroban][herder]") .txsMaybeDiscountedFee() .baseFee) { - baseFee = *phase.v0Components() .at(0) .txsMaybeDiscountedFee() @@ -5163,7 +5162,6 @@ TEST_CASE("do not flood too many transactions with DEX separation", auto& source = accs[accountIndex]; if (isDex) { - Asset asset1(ASSET_TYPE_CREDIT_ALPHANUM4); strToAssetCode(asset1.alphaNum4().assetCode, "USD"); Asset asset2(ASSET_TYPE_NATIVE); @@ -6835,7 +6833,6 @@ TEST_CASE("trigger next ledger side effects", "[herder][parallel]") TEST_CASE("detect dead nodes in quorum set", "[herder]") { - Hash networkID = sha256(getTestConfig().NETWORK_PASSPHRASE); Simulation::pointer simulation = Topologies::core( 3, 0.5, Simulation::OVER_LOOPBACK, networkID, diff --git a/src/herder/test/TxSetTests.cpp b/src/herder/test/TxSetTests.cpp index 0bdd9679f1..9d965f52c4 100644 --- a/src/herder/test/TxSetTests.cpp +++ b/src/herder/test/TxSetTests.cpp @@ -1277,7 +1277,6 @@ TEST_CASE("applicable txset validation - Soroban resources", "[txset][soroban]") } else { - for (int i = 0; i < 8; ++i) { resources.footprint.readOnly.push_back( @@ -1490,7 +1489,6 @@ TEST_CASE("applicable txset validation - Soroban resources", "[txset][soroban]") { SECTION("data dependency validation") { - auto buildAndValidate = [&](TxStageFrameList txsPerStage) { auto ledgerHash = app->getLedgerManager() .getLastClosedLedgerHeader() @@ -2068,7 +2066,6 @@ TEST_CASE("txset nomination", "[txset]") std::vector ops; if (i < dexOpsCount) { - for (uint32_t j = 1; j <= numOps; ++j) { ops.emplace_back(manageBuyOffer( diff --git a/src/herder/test/UpgradesTests.cpp b/src/herder/test/UpgradesTests.cpp index 54d1b5be02..c662219af1 100644 --- a/src/herder/test/UpgradesTests.cpp +++ b/src/herder/test/UpgradesTests.cpp @@ -924,7 +924,6 @@ TEST_CASE("SCP timing config affects consensus behavior", "[upgrades][herder]") SECTION("ledger close time changes after config upgrade") { - // Verify initial ledger close time auto initialCloseTime = simulation->getExpectedLedgerCloseTime(); REQUIRE(initialCloseTime == diff --git a/src/invariant/test/OrderBookIsNotCrossedTests.cpp b/src/invariant/test/OrderBookIsNotCrossedTests.cpp index 00973f10be..b4676ae46b 100644 --- a/src/invariant/test/OrderBookIsNotCrossedTests.cpp +++ b/src/invariant/test/OrderBookIsNotCrossedTests.cpp @@ -186,7 +186,6 @@ TEST_CASE("OrderBookIsNotCrossed in-memory order book is consistent with " TEST_CASE("OrderBookIsNotCrossed properly throws if order book is crossed", "[invariant][OrderBookIsNotCrossed]") { - VirtualClock clock; auto cfg = getTestConfig(0, Config::TESTDB_IN_MEMORY); // When testing the order book not crossed invariant, enable it and no other diff --git a/src/ledger/LedgerManager.h b/src/ledger/LedgerManager.h index 528a98fba8..dedb8099c4 100644 --- a/src/ledger/LedgerManager.h +++ b/src/ledger/LedgerManager.h @@ -158,7 +158,6 @@ class InMemorySorobanState; // thread. class LedgerManager { - protected: friend void ApplicationImpl::initialize(bool createNewDB, bool forceRebuild); diff --git a/src/ledger/LedgerTxn.cpp b/src/ledger/LedgerTxn.cpp index 091a9d817b..6ba5c1ec8a 100644 --- a/src/ledger/LedgerTxn.cpp +++ b/src/ledger/LedgerTxn.cpp @@ -2877,7 +2877,6 @@ LedgerTxnRoot::Impl::bulkApply(BulkLedgerEntryChangeAccumulator& bleca, size_t bufferThreshold, LedgerTxnConsistency cons) { - auto& upsertOffers = bleca.getOffersToUpsert(); if (upsertOffers.size() > bufferThreshold) { diff --git a/src/ledger/LedgerTxnOfferSQL.cpp b/src/ledger/LedgerTxnOfferSQL.cpp index 0c400e97c8..592064cd32 100644 --- a/src/ledger/LedgerTxnOfferSQL.cpp +++ b/src/ledger/LedgerTxnOfferSQL.cpp @@ -479,7 +479,6 @@ class BulkUpsertOffersOperation : public DatabaseTypeSpecificOperation void doPostgresSpecificOperation(soci::postgresql_session_backend* pg) override { - std::string strSellerIDs, strOfferIDs, strSellingAssets, strBuyingAssets, strAmounts, strPriceNs, strPriceDs, strPrices, strFlags, strLastModifieds, strExtensions, strLedgerExtensions; diff --git a/src/ledger/NetworkConfig.h b/src/ledger/NetworkConfig.h index bd4b47db98..7fda91a146 100644 --- a/src/ledger/NetworkConfig.h +++ b/src/ledger/NetworkConfig.h @@ -186,7 +186,6 @@ struct InitialSorobanNetworkConfig // any network. struct Protcol23UpgradedConfig { - static constexpr int64_t SOROBAN_STATE_TARGET_SIZE_BYTES = 3'000'000'000LL; // 3 GB static constexpr int64_t RENT_FEE_1KB_SOROBAN_STATE_SIZE_LOW = -17'000; diff --git a/src/ledger/test/LedgerTestUtils.cpp b/src/ledger/test/LedgerTestUtils.cpp index 4bdc44d8d7..498598dcf4 100644 --- a/src/ledger/test/LedgerTestUtils.cpp +++ b/src/ledger/test/LedgerTestUtils.cpp @@ -695,7 +695,6 @@ std::vector generateValidLedgerEntriesWithExclusions( std::unordered_set const& excludedTypes, size_t n) { - if (n > 1000) { throw "generateValidLedgerEntryWithExclusions: must generate <= 1000 " @@ -857,7 +856,6 @@ generateValidUniqueLedgerKeysWithTypes( res.reserve(n); while (res.size() < n) { - auto entry = generateValidLedgerEntryWithTypes(types); auto key = LedgerEntryKey(entry); if (seenKeys.find(key) != seenKeys.end()) diff --git a/src/main/CommandHandler.cpp b/src/main/CommandHandler.cpp index 0c323d8f36..cddd8c7659 100644 --- a/src/main/CommandHandler.cpp +++ b/src/main/CommandHandler.cpp @@ -142,7 +142,6 @@ CommandHandler::CommandHandler(Application& app) : mApp(app) void CommandHandler::addRoute(std::string const& name, HandlerRoute route) { - mServer->addRoute( name, std::bind(&CommandHandler::safeRouter, this, route, _1, _2)); } @@ -1239,7 +1238,6 @@ CommandHandler::generateLoad(std::string const& params, std::string& retStr) cfg.setMinSorobanPercentSuccess(minPercentSuccess); if (cfg.mode != LoadGenMode::SOROBAN_UPLOAD) { - auto& sorobanCfg = cfg.getMutSorobanConfig(); sorobanCfg.nInstances = parseOptionalParamOrDefault(map, "instances", 0); diff --git a/src/main/Config.cpp b/src/main/Config.cpp index a55b8f68d6..0f7bcbce4b 100644 --- a/src/main/Config.cpp +++ b/src/main/Config.cpp @@ -1,4 +1,3 @@ - // Copyright 2014 Stellar Development Foundation and contributors. Licensed // 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 diff --git a/src/main/Config.h b/src/main/Config.h index f2fcb791b0..22e90a93c4 100644 --- a/src/main/Config.h +++ b/src/main/Config.h @@ -70,7 +70,6 @@ struct ValidatorWeightConfig class Config : public std::enable_shared_from_this { - void validateConfig(ValidationThresholdLevels thresholdLevel); void loadQset(std::shared_ptr group, SCPQuorumSet& qset, uint32 level); diff --git a/src/main/SettingsUpgradeUtils.cpp b/src/main/SettingsUpgradeUtils.cpp index fd800156e7..ea74402bc8 100644 --- a/src/main/SettingsUpgradeUtils.cpp +++ b/src/main/SettingsUpgradeUtils.cpp @@ -217,7 +217,6 @@ getInvokeTx(PublicKey const& publicKey, LedgerKey const& contractCodeLedgerKey, ConfigUpgradeSet const& upgradeSet, SequenceNumber seqNum, int64_t addResourceFee) { - validateConfigUpgradeSet(upgradeSet); TransactionEnvelope txEnv; diff --git a/src/main/main.cpp b/src/main/main.cpp index dcebd0400b..968c4174d5 100644 --- a/src/main/main.cpp +++ b/src/main/main.cpp @@ -359,7 +359,6 @@ main(int argc, char* const* argv) try { - checkStellarCoreMajorVersionProtocolIdentity(); rust_bridge::check_sensible_soroban_config_for_protocol( Config::CURRENT_LEDGER_PROTOCOL_VERSION); diff --git a/src/overlay/Peer.h b/src/overlay/Peer.h index dadbfb529f..ce8e7b6a50 100644 --- a/src/overlay/Peer.h +++ b/src/overlay/Peer.h @@ -67,7 +67,6 @@ class CapacityTrackedMessage; class Peer : public std::enable_shared_from_this, public NonMovableOrCopyable { - public: static constexpr std::chrono::seconds PEER_SEND_MODE_IDLE_TIMEOUT = std::chrono::seconds(60); diff --git a/src/overlay/test/OverlayManagerTests.cpp b/src/overlay/test/OverlayManagerTests.cpp index 7665820a83..bc0d8b9a85 100644 --- a/src/overlay/test/OverlayManagerTests.cpp +++ b/src/overlay/test/OverlayManagerTests.cpp @@ -172,7 +172,6 @@ class OverlayManagerTests size_t i = 0; for (auto it = rs.begin(); it != rs.end(); ++it, ++i) { - PeerBareAddress pba{it->get(0), static_cast(it->get(1))}; auto type = it->get(2); diff --git a/src/protocol-curr/xdr b/src/protocol-curr/xdr index 0a621ec781..4b7a2ef793 160000 --- a/src/protocol-curr/xdr +++ b/src/protocol-curr/xdr @@ -1 +1 @@ -Subproject commit 0a621ec7811db000a60efae5b35f78dee3aa2533 +Subproject commit 4b7a2ef7931ab2ca2499be68d849f38190b443ca diff --git a/src/rust/soroban/p25 b/src/rust/soroban/p25 index d2ff024b72..0a0c2df704 160000 --- a/src/rust/soroban/p25 +++ b/src/rust/soroban/p25 @@ -1 +1 @@ -Subproject commit d2ff024b72f7f3f75737402ac74ca5d0093a4690 +Subproject commit 0a0c2df704edeb3cdafabfcc759eddccd6775337 diff --git a/src/scp/BallotProtocol.cpp b/src/scp/BallotProtocol.cpp index 9ab712cb44..c1636b8aa6 100644 --- a/src/scp/BallotProtocol.cpp +++ b/src/scp/BallotProtocol.cpp @@ -1401,7 +1401,6 @@ BallotProtocol::attemptBump() ZoneScoped; if (mPhase == SCP_PHASE_PREPARE || mPhase == SCP_PHASE_CONFIRM) { - // First check to see if this condition applies at all. If there // is no v-blocking set ahead of the local node, there's nothing // to do, return early. diff --git a/src/scp/Slot.cpp b/src/scp/Slot.cpp index de52f8a41f..6866ae7476 100644 --- a/src/scp/Slot.cpp +++ b/src/scp/Slot.cpp @@ -208,7 +208,6 @@ Slot::abandonBallot() bool Slot::bumpState(Value const& value, bool force) { - return mBallotProtocol.bumpState(value, force); } diff --git a/src/scp/test/SCPTests.cpp b/src/scp/test/SCPTests.cpp index 19c377f80d..f4f44b6bfa 100644 --- a/src/scp/test/SCPTests.cpp +++ b/src/scp/test/SCPTests.cpp @@ -117,7 +117,6 @@ class TestSCP : public SCPDriver { if (mQuorumSets.find(qSetHash) != mQuorumSets.end()) { - return mQuorumSets[qSetHash]; } return SCPQuorumSetPtr(); diff --git a/src/scp/test/SCPUnitTests.cpp b/src/scp/test/SCPUnitTests.cpp index 15ef34b971..f7c2ae16e1 100644 --- a/src/scp/test/SCPUnitTests.cpp +++ b/src/scp/test/SCPUnitTests.cpp @@ -56,7 +56,6 @@ class TestNominationSCP : public SCPDriver { if (mQuorumSets.find(qSetHash) != mQuorumSets.end()) { - return mQuorumSets[qSetHash]; } return SCPQuorumSetPtr(); diff --git a/src/simulation/ApplyLoad.cpp b/src/simulation/ApplyLoad.cpp index 67b3e7670c..3405951a84 100644 --- a/src/simulation/ApplyLoad.cpp +++ b/src/simulation/ApplyLoad.cpp @@ -203,7 +203,6 @@ ApplyLoad::upgradeSettingsForMaxTPS(uint32_t txsToGenerate) LedgerKey ApplyLoad::getKeyForArchivedEntry(uint64_t index) { - static const SCAddress hotArchiveContractID = [] { SCAddress addr; addr.type(SC_ADDRESS_TYPE_CONTRACT); diff --git a/src/simulation/LoadGenerator.cpp b/src/simulation/LoadGenerator.cpp index 21bcf5e0fc..da6d7d9c95 100644 --- a/src/simulation/LoadGenerator.cpp +++ b/src/simulation/LoadGenerator.cpp @@ -857,7 +857,6 @@ LoadGenerator::submitTx(GeneratedLoadConfig const& cfg, while ((status = execute(tx, cfg.mode, code)) != TransactionQueue::AddResultCode::ADD_STATUS_PENDING) { - if (cfg.mode != LoadGenMode::PAY_PREGENERATED && cfg.skipLowFeeTxs && (status == TransactionQueue::AddResultCode::ADD_STATUS_TRY_AGAIN_LATER || @@ -1422,7 +1421,6 @@ LoadGenerator::execute(TransactionFrameBasePtr txf, LoadGenMode mode, mApp.getHerder().recvTransaction(txf, true, isPregeneratedTx); if (addResult.code != TransactionQueue::AddResultCode::ADD_STATUS_PENDING) { - auto resultStr = addResult.txResult ? xdrToCerealString(addResult.txResult->getXDR(), "TransactionResult") diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp index 7f5e6ecd77..7890b2f6f3 100644 --- a/src/simulation/Simulation.cpp +++ b/src/simulation/Simulation.cpp @@ -439,7 +439,6 @@ Simulation::crankNode(NodeID const& id, VirtualClock::time_point timeout) std::size_t Simulation::crankAllNodes(int nbTicks) { - std::size_t count = 0; VirtualTimer mainQuantumTimer(*mIdleApp); diff --git a/src/simulation/Simulation.h b/src/simulation/Simulation.h index b07ece8232..d0a4521e50 100644 --- a/src/simulation/Simulation.h +++ b/src/simulation/Simulation.h @@ -1,4 +1,3 @@ - #pragma once // Copyright 2014 Stellar Development Foundation and contributors. Licensed diff --git a/src/simulation/Topologies.cpp b/src/simulation/Topologies.cpp index 1db4cd60f6..f7f3ca358f 100644 --- a/src/simulation/Topologies.cpp +++ b/src/simulation/Topologies.cpp @@ -384,7 +384,6 @@ Topologies::asymmetric(Simulation::Mode mode, Hash const& networkID, Simulation::ConfigGen confGen, int connections, Simulation::QuorumSetAdjuster qSetAdjust) { - Simulation::pointer s = Topologies::core(10, 0.7, mode, networkID, confGen, qSetAdjust); auto node = s->getNodes()[0]; diff --git a/src/test/TestAccount.cpp b/src/test/TestAccount.cpp index 6f225ce4af..066b775966 100644 --- a/src/test/TestAccount.cpp +++ b/src/test/TestAccount.cpp @@ -105,7 +105,6 @@ TestAccount::exists() const void TestAccount::applyOpsBatch(std::vector const& ops) { - for (int i = 0; i < ops.size(); i += MAX_OPS_PER_TX) { std::vector txOps( diff --git a/src/test/TestMarket.cpp b/src/test/TestMarket.cpp index b6271670d3..607012ff07 100644 --- a/src/test/TestMarket.cpp +++ b/src/test/TestMarket.cpp @@ -108,7 +108,6 @@ TestMarket::addOffer(TestAccount& account, OfferState const& state, { if (mLastAddedID != 0) { - REQUIRE(offerId == mLastAddedID + 1); } mLastAddedID = offerId; diff --git a/src/transactions/ExtendFootprintTTLOpFrame.cpp b/src/transactions/ExtendFootprintTTLOpFrame.cpp index f4f48d7b4f..7239742c32 100644 --- a/src/transactions/ExtendFootprintTTLOpFrame.cpp +++ b/src/transactions/ExtendFootprintTTLOpFrame.cpp @@ -60,7 +60,6 @@ ExtendFootprintTTLOpFrame::isOpSupported(LedgerHeader const& header) const class ExtendFootprintTTLApplyHelper : virtual public LedgerAccessHelper { - protected: AppConnector& mApp; OperationResult& mRes; diff --git a/src/transactions/ExtendFootprintTTLOpFrame.h b/src/transactions/ExtendFootprintTTLOpFrame.h index ef4d6b84b0..9ca803ac5e 100644 --- a/src/transactions/ExtendFootprintTTLOpFrame.h +++ b/src/transactions/ExtendFootprintTTLOpFrame.h @@ -14,7 +14,6 @@ class MutableTransactionResultBase; class ExtendFootprintTTLOpFrame : public OperationFrame { - ExtendFootprintTTLOp const& mExtendFootprintTTLOp; public: diff --git a/src/transactions/InvokeHostFunctionOpFrame.cpp b/src/transactions/InvokeHostFunctionOpFrame.cpp index 317e20d65c..6608bd5a4d 100644 --- a/src/transactions/InvokeHostFunctionOpFrame.cpp +++ b/src/transactions/InvokeHostFunctionOpFrame.cpp @@ -1140,7 +1140,6 @@ class InvokeHostFunctionParallelApplyHelper bool checkIfReadWriteEntryIsMarkedForAutorestore(uint32_t index) { - // If the autorestore vector is empty, there // are no entries to restore if (mAutorestoredEntries.empty()) diff --git a/src/transactions/ManageDataOpFrame.h b/src/transactions/ManageDataOpFrame.h index 56acf22068..b28e01eb75 100644 --- a/src/transactions/ManageDataOpFrame.h +++ b/src/transactions/ManageDataOpFrame.h @@ -12,7 +12,6 @@ class AbstractLedgerTxn; class ManageDataOpFrame : public OperationFrame { - ManageDataResult& innerResult(OperationResult& res) const { diff --git a/src/transactions/ParallelApplyStage.cpp b/src/transactions/ParallelApplyStage.cpp index fa1f32495a..86f9c7710b 100644 --- a/src/transactions/ParallelApplyStage.cpp +++ b/src/transactions/ParallelApplyStage.cpp @@ -15,7 +15,6 @@ ApplyStage::Iterator::Iterator(std::vector const& clusters, TxBundle const& ApplyStage::Iterator::operator*() const { - if (mClusterIndex >= mClusters.size() || mTxIndex >= mClusters[mClusterIndex].size()) { diff --git a/src/transactions/ParallelApplyUtils.h b/src/transactions/ParallelApplyUtils.h index 0d67b65db3..2d656d77ce 100644 --- a/src/transactions/ParallelApplyUtils.h +++ b/src/transactions/ParallelApplyUtils.h @@ -19,7 +19,6 @@ class GlobalParallelApplyLedgerState; class ParallelLedgerInfo { - public: ParallelLedgerInfo(uint32_t version, uint32_t seq, uint32_t reserve, TimePoint time, Hash const& id) @@ -348,7 +347,6 @@ class PreV23LedgerAccessHelper : virtual public LedgerAccessHelper class ParallelLedgerAccessHelper : virtual public LedgerAccessHelper { - protected: ParallelLedgerAccessHelper( ThreadParallelApplyLedgerState const& threadState, diff --git a/src/transactions/RestoreFootprintOpFrame.cpp b/src/transactions/RestoreFootprintOpFrame.cpp index 12bcf0bca0..ccd39dedf5 100644 --- a/src/transactions/RestoreFootprintOpFrame.cpp +++ b/src/transactions/RestoreFootprintOpFrame.cpp @@ -57,7 +57,6 @@ RestoreFootprintOpFrame::RestoreFootprintOpFrame( class RestoreFootprintApplyHelper : virtual public LedgerAccessHelper { - protected: AppConnector& mApp; OperationResult& mRes; @@ -382,7 +381,6 @@ RestoreFootprintOpFrame::doParallelApply( std::optional& refundableFeeTracker, OperationMetaBuilder& opMeta) const { - releaseAssertOrThrow( protocolVersionStartsFrom(ledgerInfo.getLedgerVersion(), PARALLEL_SOROBAN_PHASE_PROTOCOL_VERSION)); diff --git a/src/transactions/SetTrustLineFlagsOpFrame.cpp b/src/transactions/SetTrustLineFlagsOpFrame.cpp index 41256ac282..9757de8597 100644 --- a/src/transactions/SetTrustLineFlagsOpFrame.cpp +++ b/src/transactions/SetTrustLineFlagsOpFrame.cpp @@ -168,7 +168,6 @@ SetTrustLineFlagsOpFrame::isAuthRevocationValid(AbstractLedgerTxn& ltx, bool& authRevocable, OperationResult& res) const { - // Load the source account entry LedgerTxn ltxSource(ltx); // ltxSource will be rolled back auto header = ltxSource.loadHeader(); diff --git a/src/transactions/TransactionMeta.cpp b/src/transactions/TransactionMeta.cpp index 14522cabc9..db18a026d2 100644 --- a/src/transactions/TransactionMeta.cpp +++ b/src/transactions/TransactionMeta.cpp @@ -416,7 +416,6 @@ OperationMetaBuilder::setLedgerChangesFromSuccessfulOp( LedgerEntryChanges changes; for (auto const& [lk, le] : res.getModifiedEntryMap()) { - auto prevLe = threadState.getLiveEntryOpt(lk); if (prevLe) diff --git a/src/transactions/TransactionUtils.cpp b/src/transactions/TransactionUtils.cpp index cdd2f74ad8..f34299ce57 100644 --- a/src/transactions/TransactionUtils.cpp +++ b/src/transactions/TransactionUtils.cpp @@ -1566,7 +1566,6 @@ removeOffersAndPoolShareTrustLines(AbstractLedgerTxn& ltx, if (isIssuer(accountID, assetInPool)) { - opEventManager.newBurnEvent( assetInPool, makeLiquidityPoolAddress(poolID), amount); diff --git a/src/transactions/test/AllowTrustTests.cpp b/src/transactions/test/AllowTrustTests.cpp index 2922eca0d3..a61ec86db1 100644 --- a/src/transactions/test/AllowTrustTests.cpp +++ b/src/transactions/test/AllowTrustTests.cpp @@ -43,7 +43,6 @@ namespace detail template struct TestStub { - static void for_versions(uint32 from, uint32 to, Application& app, std::function const& f) diff --git a/src/transactions/test/InvokeHostFunctionTests.cpp b/src/transactions/test/InvokeHostFunctionTests.cpp index 0aeb1c9edc..def04b7cb3 100644 --- a/src/transactions/test/InvokeHostFunctionTests.cpp +++ b/src/transactions/test/InvokeHostFunctionTests.cpp @@ -1362,7 +1362,6 @@ TEST_CASE("Soroban footprint validation", "[tx][soroban]") appCfg.TESTING_UPGRADE_LEDGER_PROTOCOL_VERSION, ProtocolVersion::V_23)) { - auto const maxDiskReads = cfg.mTxMaxDiskReadEntries; // contract instance and WASM entry are already in the fooprint @@ -2127,7 +2126,6 @@ TEST_CASE("resource fee exceeds uint32", "[tx][soroban][feebump]") auto runTests = [&](bool selfFeeBump) { SECTION("success") { - SECTION("low inclusion fee") { REQUIRE(runTest(10000 * stroopsInXlm, 200, expectedRentFee, @@ -4541,7 +4539,6 @@ TEST_CASE_VERSIONS("state archival operation errors", "[tx][soroban][archival]") SECTION("extend operation") { - SorobanResources extendResources; extendResources.footprint.readOnly = dataKeys; extendResources.diskReadBytes = 9'000; @@ -6240,7 +6237,6 @@ TEST_CASE("Soroban classic account authentication", "[tx][soroban]") } SECTION("wrong key type") { - fieldsMap[0].key = makeBytesSCVal(std::string("public_key")); REQUIRE(singleInvocation(signer, baseCredentials) == InvokeHostFunctionResultCode::INVOKE_HOST_FUNCTION_TRAPPED); @@ -6999,7 +6995,6 @@ TEST_CASE("contract constructor support", "[tx][soroban]") SECTION("constructor with no arguments") { - auto testNoArgConstructor = [&](ConstructorParams::HostFnVersion hostFnVersion, ConstructorParams::HostFnVersion authFnVersion) { @@ -7146,7 +7141,6 @@ TEST_CASE("reusable module cache", "[soroban][modulecache]") ttl = stest.getNetworkCfg().stateArchivalSettings().minPersistentTTL; for (auto const& wasm : testWasms) { - stest.deployWasmContract(wasm); contractHashes.push_back(sha256(wasm)); } @@ -7262,7 +7256,6 @@ TEST_CASE("Module cache miss on immediate execution", SECTION("same ledger upload and execution") { - // Here we're going to create 4 txs in the same ledger (so they have to // come from 4 separate accounts). The 1st uploads a contract wasm, the // 2nd creates a contract, and the 3rd and 4th run it. diff --git a/src/transactions/test/SorobanTxTestUtils.cpp b/src/transactions/test/SorobanTxTestUtils.cpp index a80a0f9e53..6e0dfe130c 100644 --- a/src/transactions/test/SorobanTxTestUtils.cpp +++ b/src/transactions/test/SorobanTxTestUtils.cpp @@ -1794,7 +1794,6 @@ AssetContractTestClient::transfer(TestAccount& fromAcc, auto postTransferToBalance = getBalance(toAddr); if (success) { - if (!fromIsIssuer) { int64_t expectedBalance = preTransferFromBalance - amount; @@ -2141,7 +2140,6 @@ ContractStorageTestClient::del(std::string const& key, ContractDataDurability durability, std::optional spec) { - auto invocation = delInvocation(key, durability, spec); invocation.withExactNonRefundableResourceFee().invoke(); return *invocation.getResultCode(); diff --git a/src/transactions/test/TxEnvelopeTests.cpp b/src/transactions/test/TxEnvelopeTests.cpp index a7c4a721d2..9a3188261f 100644 --- a/src/transactions/test/TxEnvelopeTests.cpp +++ b/src/transactions/test/TxEnvelopeTests.cpp @@ -2591,7 +2591,6 @@ TEST_CASE_VERSIONS("soroban transaction validation", "[tx][envelope][soroban]") if (i < InitialSorobanNetworkConfig::TX_MAX_WRITE_LEDGER_ENTRIES) { - resources.footprint.readWrite.push_back(key); } else diff --git a/src/util/NonCopyable.h b/src/util/NonCopyable.h index 00469879d0..52c368ea63 100644 --- a/src/util/NonCopyable.h +++ b/src/util/NonCopyable.h @@ -21,7 +21,8 @@ struct NonMovable NonMovable& operator=(NonMovable&&) = delete; }; -struct NonMovableOrCopyable : private NonCopyable, NonMovable +struct NonMovableOrCopyable : private NonCopyable, + NonMovable { NonMovableOrCopyable() = default; }; diff --git a/src/util/TxResource.cpp b/src/util/TxResource.cpp index 425556747e..c14c5ed3e2 100644 --- a/src/util/TxResource.cpp +++ b/src/util/TxResource.cpp @@ -1,4 +1,3 @@ - // Copyright 2023 Stellar Development Foundation and contributors. Licensed // 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 diff --git a/src/util/test/BinaryFuseTests.cpp b/src/util/test/BinaryFuseTests.cpp index 52215710c2..70e7ea6f4a 100644 --- a/src/util/test/BinaryFuseTests.cpp +++ b/src/util/test/BinaryFuseTests.cpp @@ -116,7 +116,6 @@ testFilter(double expectedFalsePositiveRate) TEST_CASE("binary fuse filter", "[BinaryFuseFilter][!hide]") { - SECTION("8 bit") { auto epsilon = 1ul << 8; diff --git a/src/util/test/MetricTests.cpp b/src/util/test/MetricTests.cpp index eba19efc9e..5ee87bde51 100644 --- a/src/util/test/MetricTests.cpp +++ b/src/util/test/MetricTests.cpp @@ -391,7 +391,6 @@ TEST_CASE("percentile calculation - uniform", "[percentile][medida_math]") TEST_CASE("percentile calculation - gamma", "[percentile][medida_math]") { - auto snap = sampleFrom(4.0, 100.0); gamma_4_100_pct.checkAgainst(snap); }