Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: AllDefinitions
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: false
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
Expand All @@ -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
Expand Down Expand Up @@ -78,14 +75,18 @@ IndentWidth: 4
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
KeepEmptyLines:
AtStartOfBlock: false
AtStartOfFile: false
AtEndOfFile: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PackConstructorInitializers: NextLine
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
Expand All @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/bucket/BucketListBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ bool
BucketListBase<BucketT>::shouldMergeWithEmptyCurr(uint32_t ledger,
uint32_t level)
{

if (level != 0)
{
// Round down the current ledger to when the merge was started, and
Expand Down
3 changes: 0 additions & 3 deletions src/bucket/BucketManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,6 @@ BucketManager::getBucketDir() const

BucketManager::~BucketManager()
{

deleteTmpDirAndUnlockBucketDir();
}

Expand Down Expand Up @@ -1291,7 +1290,6 @@ BucketManager::resolveBackgroundEvictionScan(
void
BucketManager::calculateSkipValues(LedgerHeader& currentHeader)
{

if ((currentHeader.ledgerSeq % SKIP_1) == 0)
{
int v = currentHeader.ledgerSeq - SKIP_1;
Expand All @@ -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];
Expand Down
1 change: 0 additions & 1 deletion src/bucket/BucketOutputIterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ BucketOutputIterator<BucketT>::BucketOutputIterator(std::string const& tmpDir,
meta.ledgerVersion,
LiveBucket::FIRST_PROTOCOL_SUPPORTING_INITENTRY_AND_METAENTRY))
{

if constexpr (std::is_same_v<BucketT, LiveBucket>)
{
BucketEntry bme;
Expand Down
1 change: 0 additions & 1 deletion src/bucket/BucketSnapshot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ BucketSnapshotBase<BucketT>::loadKeys(
std::shared_ptr<typename BucketT::EntryT const> entryOp;
switch (indexRes.getState())
{

// Index had entry in cache
case IndexReturnState::CACHE_HIT:
if constexpr (std::is_same_v<BucketT, LiveBucket>)
Expand Down
1 change: 0 additions & 1 deletion src/bucket/LiveBucketIndex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}",
Expand Down
1 change: 0 additions & 1 deletion src/bucket/SearchableBucketList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<int64_t, UnorderedMap<AccountID, int64_t>::const_iterator,
std::greater<int64_t>>
Expand Down
1 change: 0 additions & 1 deletion src/bucket/test/BucketIndexTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ class BucketIndexTest
}
else if (sorobanOnly)
{

entries =
LedgerTestUtils::generateValidUniqueLedgerEntriesWithTypes(
{CONTRACT_DATA, CONTRACT_CODE}, 10, mGeneratedKeys);
Expand Down
1 change: 0 additions & 1 deletion src/bucket/test/BucketManagerTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
1 change: 0 additions & 1 deletion src/crypto/SecretKey.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
1 change: 0 additions & 1 deletion src/database/test/DatabaseTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/herder/Herder.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

#include "herder/Herder.h"

namespace stellar
Expand Down
1 change: 0 additions & 1 deletion src/herder/HerderPersistenceImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ class Application;

class HerderPersistenceImpl : public HerderPersistence
{

public:
HerderPersistenceImpl(Application& app);
~HerderPersistenceImpl();
Expand Down
4 changes: 0 additions & 4 deletions src/herder/HerderSCPDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
{
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -1385,7 +1382,6 @@ size_t
HerderSCPDriver::TxSetValidityKeyHash::operator()(
TxSetValidityKey const& key) const
{

size_t res = std::hash<Hash>()(std::get<0>(key));
hashMix(res, std::hash<Hash>()(std::get<1>(key)));
hashMix(res, std::get<2>(key));
Expand Down
1 change: 0 additions & 1 deletion src/herder/QuorumIntersectionCheckerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 0 additions & 2 deletions src/herder/QuorumIntersectionCheckerImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -449,7 +448,6 @@ class MinQuorumEnumerator
// MinQuorumEnumerator to recursively scan the powerset.
class QuorumIntersectionCheckerImpl : public stellar::QuorumIntersectionChecker
{

std::optional<stellar::Config> const mCfg;

struct Stats
Expand Down
4 changes: 0 additions & 4 deletions src/herder/TxSetFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}",
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -1674,7 +1672,6 @@ TxSetPhaseFrame::getSequentialTxs() const
void
TxSetPhaseFrame::toXDR(TransactionPhase& xdrPhase) const
{

if (isParallel())
{
parallelPhaseToXdr(mStages, *mInclusionFeeMap, xdrPhase);
Expand Down Expand Up @@ -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"),
Expand Down
3 changes: 0 additions & 3 deletions src/herder/test/HerderTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3148,7 +3148,6 @@ TEST_CASE("soroban txs each parameter surge priced", "[soroban][herder]")
.txsMaybeDiscountedFee()
.baseFee)
{

baseFee = *phase.v0Components()
.at(0)
.txsMaybeDiscountedFee()
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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,
Expand Down
3 changes: 0 additions & 3 deletions src/herder/test/TxSetTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -2068,7 +2066,6 @@ TEST_CASE("txset nomination", "[txset]")
std::vector<Operation> ops;
if (i < dexOpsCount)
{

for (uint32_t j = 1; j <= numOps; ++j)
{
ops.emplace_back(manageBuyOffer(
Expand Down
1 change: 0 additions & 1 deletion src/herder/test/UpgradesTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ==
Expand Down
1 change: 0 additions & 1 deletion src/invariant/test/OrderBookIsNotCrossedTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/ledger/LedgerManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ class InMemorySorobanState;
// thread.
class LedgerManager
{

protected:
friend void ApplicationImpl::initialize(bool createNewDB,
bool forceRebuild);
Expand Down
1 change: 0 additions & 1 deletion src/ledger/LedgerTxn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2877,7 +2877,6 @@ LedgerTxnRoot::Impl::bulkApply(BulkLedgerEntryChangeAccumulator& bleca,
size_t bufferThreshold,
LedgerTxnConsistency cons)
{

auto& upsertOffers = bleca.getOffersToUpsert();
if (upsertOffers.size() > bufferThreshold)
{
Expand Down
1 change: 0 additions & 1 deletion src/ledger/LedgerTxnOfferSQL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,6 @@ class BulkUpsertOffersOperation : public DatabaseTypeSpecificOperation<void>
void
doPostgresSpecificOperation(soci::postgresql_session_backend* pg) override
{

std::string strSellerIDs, strOfferIDs, strSellingAssets,
strBuyingAssets, strAmounts, strPriceNs, strPriceDs, strPrices,
strFlags, strLastModifieds, strExtensions, strLedgerExtensions;
Expand Down
1 change: 0 additions & 1 deletion src/ledger/NetworkConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions src/ledger/test/LedgerTestUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,6 @@ std::vector<LedgerEntry>
generateValidLedgerEntriesWithExclusions(
std::unordered_set<LedgerEntryType> const& excludedTypes, size_t n)
{

if (n > 1000)
{
throw "generateValidLedgerEntryWithExclusions: must generate <= 1000 "
Expand Down Expand Up @@ -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())
Expand Down
2 changes: 0 additions & 2 deletions src/main/CommandHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down Expand Up @@ -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<uint32_t>(map, "instances", 0);
Expand Down
1 change: 0 additions & 1 deletion src/main/Config.cpp
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Loading
Loading