chore: Remove unnecessary clang-format off/on directives (#6682)

Co-authored-by: Bart <11445373+bthomee@users.noreply.github.com>
This commit is contained in:
Bart
2026-03-31 11:38:04 -04:00
committed by GitHub
parent bb95a7d6cd
commit 7f53351920
22 changed files with 843 additions and 934 deletions

View File

@@ -68,9 +68,7 @@ SharedIntrusive<T>::operator=(SharedIntrusive const& rhs)
template <class T>
template <class TT>
// clang-format off
requires std::convertible_to<TT*, T*>
// clang-format on
requires std::convertible_to<TT*, T*>
SharedIntrusive<T>&
SharedIntrusive<T>::operator=(SharedIntrusive<TT> const& rhs)
{
@@ -101,9 +99,7 @@ SharedIntrusive<T>::operator=(SharedIntrusive&& rhs)
template <class T>
template <class TT>
// clang-format off
requires std::convertible_to<TT*, T*>
// clang-format on
requires std::convertible_to<TT*, T*>
SharedIntrusive<T>&
SharedIntrusive<T>::operator=(SharedIntrusive<TT>&& rhs)
{
@@ -307,9 +303,7 @@ WeakIntrusive<T>::WeakIntrusive(SharedIntrusive<T> const& rhs) : ptr_{rhs.unsafe
template <class T>
template <class TT>
// clang-format off
requires std::convertible_to<TT*, T*>
// clang-format on
requires std::convertible_to<TT*, T*>
WeakIntrusive<T>&
WeakIntrusive<T>::operator=(SharedIntrusive<TT> const& rhs)
{
@@ -454,9 +448,7 @@ SharedWeakUnion<T>::operator=(SharedWeakUnion const& rhs)
template <class T>
template <class TT>
// clang-format off
requires std::convertible_to<TT*, T*>
// clang-format on
requires std::convertible_to<TT*, T*>
SharedWeakUnion<T>&
SharedWeakUnion<T>::operator=(SharedIntrusive<TT> const& rhs)
{
@@ -470,9 +462,7 @@ SharedWeakUnion<T>::operator=(SharedIntrusive<TT> const& rhs)
template <class T>
template <class TT>
// clang-format off
requires std::convertible_to<TT*, T*>
// clang-format on
requires std::convertible_to<TT*, T*>
SharedWeakUnion<T>&
SharedWeakUnion<T>::operator=(SharedIntrusive<TT>&& rhs)
{

View File

@@ -215,11 +215,8 @@ public:
// We want to allocate the memory at a 2 MiB boundary, to make it
// possible to use hugepage mappings on Linux:
auto buf = boost::alignment::aligned_alloc(megabytes(std::size_t(2)), size);
// clang-format off
if (!buf) [[unlikely]]
return nullptr;
// clang-format on
#if BOOST_OS_LINUX
// When allocating large blocks, attempt to leverage Linux's

View File

@@ -25,16 +25,10 @@ extern nonPresentObject_t nonPresentObject;
// Concept to constrain STVar constructors, which
// instantiate ST* types from SerializedTypeID
// clang-format off
template <typename... Args>
concept ValidConstructSTArgs =
(std::is_same_v<
std::tuple<std::remove_cvref_t<Args>...>,
std::tuple<SField>> ||
std::is_same_v<
std::tuple<std::remove_cvref_t<Args>...>,
std::tuple<SerialIter, SField>>);
// clang-format on
(std::is_same_v<std::tuple<std::remove_cvref_t<Args>...>, std::tuple<SField>> ||
std::is_same_v<std::tuple<std::remove_cvref_t<Args>...>, std::tuple<SerialIter, SField>>);
// "variant" that can hold any type of serialized object
// and includes a small-object allocation optimization.

View File

@@ -11,66 +11,65 @@
#error "undefined macro: XRPL_RETIRE_FIX"
#endif
// clang-format off
// Add new amendments to the top of this list.
// Keep it sorted in reverse chronological order.
XRPL_FIX (Security3_1_3, Supported::no, VoteBehavior::DefaultNo)
XRPL_FIX (PermissionedDomainInvariant, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (ExpiredNFTokenOfferRemoval, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (BatchInnerSigs, Supported::no, VoteBehavior::DefaultNo)
XRPL_FEATURE(LendingProtocol, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(PermissionDelegationV1_1, Supported::no, VoteBehavior::DefaultNo)
XRPL_FIX (DirectoryLimit, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (IncludeKeyletFields, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(DynamicMPT, Supported::no, VoteBehavior::DefaultNo)
XRPL_FIX (TokenEscrowV1, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (PriceOracleOrder, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (MPTDeliveredAmount, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (AMMClawbackRounding, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(TokenEscrow, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (EnforceNFTokenTrustlineV2, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (AMMv1_3, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(PermissionedDEX, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(Batch, Supported::no, VoteBehavior::DefaultNo)
XRPL_FEATURE(SingleAssetVault, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (PayChanCancelAfter, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (Security3_1_3, Supported::no, VoteBehavior::DefaultNo)
XRPL_FIX (PermissionedDomainInvariant, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (ExpiredNFTokenOfferRemoval, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (BatchInnerSigs, Supported::no, VoteBehavior::DefaultNo)
XRPL_FEATURE(LendingProtocol, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(PermissionDelegationV1_1, Supported::no, VoteBehavior::DefaultNo)
XRPL_FIX (DirectoryLimit, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (IncludeKeyletFields, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(DynamicMPT, Supported::no, VoteBehavior::DefaultNo)
XRPL_FIX (TokenEscrowV1, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (PriceOracleOrder, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (MPTDeliveredAmount, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (AMMClawbackRounding, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(TokenEscrow, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (EnforceNFTokenTrustlineV2, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (AMMv1_3, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(PermissionedDEX, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(Batch, Supported::no, VoteBehavior::DefaultNo)
XRPL_FEATURE(SingleAssetVault, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (PayChanCancelAfter, Supported::yes, VoteBehavior::DefaultNo)
// Check flags in Credential transactions
XRPL_FIX (InvalidTxFlags, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (FrozenLPTokenTransfer, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(DeepFreeze, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(PermissionedDomains, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(DynamicNFT, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(Credentials, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(AMMClawback, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (AMMv1_2, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(MPTokensV1, Supported::yes, VoteBehavior::DefaultNo)
// InvariantsV1_1 will be changes to Supported::yes when all the
// invariants expected to be included under it are complete.
XRPL_FEATURE(InvariantsV1_1, Supported::no, VoteBehavior::DefaultNo)
XRPL_FIX (NFTokenPageLinks, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (InnerObjTemplate2, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (EnforceNFTokenTrustline, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (ReducedOffersV2, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(NFTokenMintOffer, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (AMMv1_1, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (PreviousTxnID, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (XChainRewardRounding, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (EmptyDID, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(PriceOracle, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (AMMOverflowOffer, Supported::yes, VoteBehavior::DefaultYes)
XRPL_FIX (InnerObjTemplate, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (NFTokenReserve, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (FillOrKill, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(DID, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (DisallowIncomingV1, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(XChainBridge, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(AMM, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(Clawback, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (UniversalNumber, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(XRPFees, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (RemoveNFTokenAutoTrustLine, Supported::yes, VoteBehavior::DefaultYes)
XRPL_FIX (InvalidTxFlags, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (FrozenLPTokenTransfer, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(DeepFreeze, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(PermissionedDomains, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(DynamicNFT, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(Credentials, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(AMMClawback, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (AMMv1_2, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(MPTokensV1, Supported::yes, VoteBehavior::DefaultNo)
// InvariantsV1_1 will be changed to Supported::yes when all the invariants expected to be included
// under it are complete.
XRPL_FEATURE(InvariantsV1_1, Supported::no, VoteBehavior::DefaultNo)
XRPL_FIX (NFTokenPageLinks, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (InnerObjTemplate2, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (EnforceNFTokenTrustline, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (ReducedOffersV2, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(NFTokenMintOffer, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (AMMv1_1, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (PreviousTxnID, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (XChainRewardRounding, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (EmptyDID, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(PriceOracle, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (AMMOverflowOffer, Supported::yes, VoteBehavior::DefaultYes)
XRPL_FIX (InnerObjTemplate, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (NFTokenReserve, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (FillOrKill, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(DID, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (DisallowIncomingV1, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(XChainBridge, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(AMM, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(Clawback, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (UniversalNumber, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(XRPFees, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (RemoveNFTokenAutoTrustLine, Supported::yes, VoteBehavior::DefaultYes)
// The following amendments are obsolete, but must remain supported
// because they could potentially get enabled.
@@ -144,5 +143,3 @@ XRPL_RETIRE_FEATURE(SortedDirectories)
XRPL_RETIRE_FEATURE(TicketBatch)
XRPL_RETIRE_FEATURE(TickSize)
XRPL_RETIRE_FEATURE(TrustSetAuth)
// clang-format on

View File

@@ -5,7 +5,6 @@
#error "undefined macro: TYPED_SFIELD"
#endif
// clang-format off
// untyped
UNTYPED_SFIELD(sfLedgerEntry, LEDGERENTRY, 257)
@@ -421,5 +420,3 @@ UNTYPED_SFIELD(sfAcceptedCredentials, ARRAY, 28)
UNTYPED_SFIELD(sfPermissions, ARRAY, 29)
UNTYPED_SFIELD(sfRawTransactions, ARRAY, 30)
UNTYPED_SFIELD(sfBatchSigners, ARRAY, 31, SField::sMD_Default, SField::notSigning)
// clang-format on

File diff suppressed because it is too large Load Diff

View File

@@ -5,38 +5,30 @@
namespace xrpl {
namespace Resource {
// clang-format off
/** Schedule of fees charged for imposing load on the server. */
/** @{ */
extern Charge const feeMalformedRequest; // A request that we can immediately
// tell is invalid
extern Charge const feeRequestNoReply; // A request that we cannot satisfy
extern Charge const feeInvalidSignature; // An object whose signature we had
// to check and it failed
extern Charge const feeUselessData; // Data we have no use for
extern Charge const feeInvalidData; // Data we have to verify before
// rejecting
extern Charge const feeMalformedRequest; // A request that we can immediately tell is invalid.
extern Charge const feeRequestNoReply; // A request that we cannot satisfy.
extern Charge const feeInvalidSignature; // An object whose signature we had to check that failed.
extern Charge const feeUselessData; // Data we have no use for.
extern Charge const feeInvalidData; // Data we have to verify before rejecting.
// RPC loads
extern Charge const feeMalformedRPC; // An RPC request that we can
// immediately tell is invalid.
extern Charge const feeReferenceRPC; // A default "reference" unspecified
// load
extern Charge const feeExceptionRPC; // RPC load that causes an exception
extern Charge const feeMediumBurdenRPC; // A somewhat burdensome RPC load
extern Charge const feeHeavyBurdenRPC; // A very burdensome RPC load
extern Charge const feeMalformedRPC; // An RPC request that we can immediately tell is invalid.
extern Charge const feeReferenceRPC; // A default "reference" unspecified load.
extern Charge const feeExceptionRPC; // RPC load that causes an exception.
extern Charge const feeMediumBurdenRPC; // A somewhat burdensome RPC load.
extern Charge const feeHeavyBurdenRPC; // A very burdensome RPC load.
// Peer loads
extern Charge const feeTrivialPeer; // Requires no reply
extern Charge const feeModerateBurdenPeer; // Requires some work
extern Charge const feeHeavyBurdenPeer; // Extensive work
extern Charge const feeTrivialPeer; // Requires no reply.
extern Charge const feeModerateBurdenPeer; // Requires some work.
extern Charge const feeHeavyBurdenPeer; // Extensive work.
// Administrative
extern Charge const feeWarning; // The cost of receiving a warning
extern Charge const feeDrop; // The cost of being dropped for
// excess load
extern Charge const feeWarning; // The cost of receiving a warning.
extern Charge const feeDrop; // The cost of being dropped for excess load.
/** @} */
// clang-format on
} // namespace Resource
} // namespace xrpl

View File

@@ -147,29 +147,26 @@ public:
/**
If this step is a DirectStepI, return the quality in of the dst account.
*/
*/
virtual std::uint32_t
lineQualityIn(ReadView const&) const
{
return QUALITY_ONE;
}
// clang-format off
/**
Find an upper bound of quality for the step
@param v view to query the ledger state from
@param prevStepDir Set to DebtDirection::redeems if the previous step redeems.
@return A pair. The first element is the upper bound of quality for the step, or std::nullopt if the
step is dry. The second element will be set to DebtDirection::redeems if this steps redeems,
DebtDirection:issues if this step issues.
@note it is an upper bound because offers on the books may be unfunded.
If there is always a funded offer at the tip of the book, then we could
rename this `theoreticalQuality` rather than `qualityUpperBound`. It
could still differ from the actual quality, but except for "dust" amounts,
it should be a good estimate for the actual quality.
*/
// clang-format on
@return A pair. The first element is the upper bound of quality for the step, or std::nullopt
if the step is dry. The second element will be set to DebtDirection::redeems if this
steps redeems, DebtDirection:issues if this step issues.
@note It is an upper bound because offers on the books may be unfunded. If there is always a
funded offer at the tip of the book, then we could rename this `theoreticalQuality`
rather than `qualityUpperBound`. It could still differ from the actual quality, but
except for "dust" amounts, it should be a good estimate for the actual quality.
*/
virtual std::pair<std::optional<Quality>, DebtDirection>
qualityUpperBound(ReadView const& v, DebtDirection prevStepDir) const = 0;

View File

@@ -121,7 +121,6 @@ withinRelativeDistance(Quality const& calcQuality, Quality const& reqQuality, Nu
* @param dist requested relative distance
* @return true if within dist, false otherwise
*/
// clang-format off
template <typename Amt>
requires(
std::is_same_v<Amt, STAmount> || std::is_same_v<Amt, IOUAmount> ||
@@ -134,7 +133,6 @@ withinRelativeDistance(Amt const& calc, Amt const& req, Number const& dist)
auto const [min, max] = std::minmax(calc, req);
return ((max - min) / max) < dist;
}
// clang-format on
/** Solve quadratic equation to find takerGets or takerPays. Round
* to minimize the amount in order to maximize the quality.

View File

@@ -38,22 +38,22 @@ STValidation::validationFormat()
// guarantee the initialization order.
// clang-format off
static SOTemplate const format{
{sfFlags, soeREQUIRED},
{sfLedgerHash, soeREQUIRED},
{sfLedgerSequence, soeREQUIRED},
{sfCloseTime, soeOPTIONAL},
{sfLoadFee, soeOPTIONAL},
{sfAmendments, soeOPTIONAL},
{sfBaseFee, soeOPTIONAL},
{sfReserveBase, soeOPTIONAL},
{sfReserveIncrement, soeOPTIONAL},
{sfSigningTime, soeREQUIRED},
{sfSigningPubKey, soeREQUIRED},
{sfSignature, soeREQUIRED},
{sfConsensusHash, soeOPTIONAL},
{sfCookie, soeDEFAULT},
{sfValidatedHash, soeOPTIONAL},
{sfServerVersion, soeOPTIONAL},
{sfFlags, soeREQUIRED},
{sfLedgerHash, soeREQUIRED},
{sfLedgerSequence, soeREQUIRED},
{sfCloseTime, soeOPTIONAL},
{sfLoadFee, soeOPTIONAL},
{sfAmendments, soeOPTIONAL},
{sfBaseFee, soeOPTIONAL},
{sfReserveBase, soeOPTIONAL},
{sfReserveIncrement, soeOPTIONAL},
{sfSigningTime, soeREQUIRED},
{sfSigningPubKey, soeREQUIRED},
{sfSignature, soeREQUIRED},
{sfConsensusHash, soeOPTIONAL},
{sfCookie, soeDEFAULT},
{sfValidatedHash, soeOPTIONAL},
{sfServerVersion, soeOPTIONAL},
// featureXRPFees
{sfBaseFeeDrops, soeOPTIONAL},
{sfReserveBaseDrops, soeOPTIONAL},

View File

@@ -95,34 +95,32 @@ with_txn_type(Rules const& rules, TxType txnType, F&& f)
// For Transactor::Normal
//
// clang-format off
// Current formatter for rippled is based on clang-10, which does not handle `requires` clauses
template <class T>
requires(T::ConsequencesFactory == Transactor::Normal)
requires(T::ConsequencesFactory == Transactor::Normal)
TxConsequences
consequences_helper(PreflightContext const& ctx)
consequences_helper(PreflightContext const& ctx)
{
return TxConsequences(ctx.tx);
};
// For Transactor::Blocker
template <class T>
requires(T::ConsequencesFactory == Transactor::Blocker)
requires(T::ConsequencesFactory == Transactor::Blocker)
TxConsequences
consequences_helper(PreflightContext const& ctx)
consequences_helper(PreflightContext const& ctx)
{
return TxConsequences(ctx.tx, TxConsequences::blocker);
};
// For Transactor::Custom
template <class T>
requires(T::ConsequencesFactory == Transactor::Custom)
requires(T::ConsequencesFactory == Transactor::Custom)
TxConsequences
consequences_helper(PreflightContext const& ctx)
consequences_helper(PreflightContext const& ctx)
{
return T::makeTxConsequences(ctx);
};
// clang-format on
static std::pair<NotTEC, TxConsequences>
invoke_preflight(PreflightContext const& ctx)

View File

@@ -50,12 +50,10 @@ AMMLiquidity<TIn, TOut>::generateFibSeqOffer(TAmounts<TIn, TOut> const& balances
if (ammContext_.curIters() == 0)
return cur;
// clang-format off
constexpr std::uint32_t fib[AMMContext::MaxIterations] = {
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987,
1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393,
196418, 317811, 514229, 832040, 1346269};
// clang-format on
1, 2, 3, 5, 8, 13, 21, 34, 55, 89,
144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946,
17711, 28657, 46368, 75025, 121393, 196418, 317811, 514229, 832040, 1346269};
XRPL_ASSERT(
!ammContext_.maxItersReached(),

View File

@@ -325,28 +325,26 @@ CheckCash::doApply()
STAmount initialBalance(flowDeliver.issue());
initialBalance.setIssuer(noAccount());
// clang-format off
if (TER const ter = trustCreate(
psb, // payment sandbox
destLow, // is dest low?
issuer, // source
account_, // destination
trustLineKey.key, // ledger index
sleDst, // Account to add to
false, // authorize account
(sleDst->getFlags() & lsfDefaultRipple) == 0,
false, // freeze trust line
false, // deep freeze trust line
initialBalance, // zero initial balance
Issue(currency, account_), // limit of zero
0, // quality in
0, // quality out
viewJ); // journal
psb, // payment sandbox
destLow, // is dest low?
issuer, // source
account_, // destination
trustLineKey.key, // ledger index
sleDst, // Account to add to
false, // authorize account
(sleDst->getFlags() & lsfDefaultRipple) == 0, //
false, // freeze trust line
false, // deep freeze trust line
initialBalance, // zero initial balance
Issue(currency, account_), // limit of zero
0, // quality in
0, // quality out
viewJ); // journal
!isTesSuccess(ter))
{
return ter;
}
// clang-format on
psb.update(sleDst);

View File

@@ -69,28 +69,26 @@ escrowUnlockApplyHelper<Issue>(
STAmount initialBalance(amount.issue());
initialBalance.setIssuer(noAccount());
// clang-format off
if (TER const ter = trustCreate(
view, // payment sandbox
recvLow, // is dest low?
issuer, // source
receiver, // destination
trustLineKey.key, // ledger index
sleDest, // Account to add to
false, // authorize account
(sleDest->getFlags() & lsfDefaultRipple) == 0,
false, // freeze trust line
false, // deep freeze trust line
initialBalance, // zero initial balance
Issue(currency, receiver), // limit of zero
0, // quality in
0, // quality out
journal); // journal
view, // payment sandbox
recvLow, // is dest low?
issuer, // source
receiver, // destination
trustLineKey.key, // ledger index
sleDest, // Account to add to
false, // authorize account
(sleDest->getFlags() & lsfDefaultRipple) == 0, //
false, // freeze trust line
false, // deep freeze trust line
initialBalance, // zero initial balance
Issue(currency, receiver), // limit of zero
0, // quality in
0, // quality out
journal); // journal
!isTesSuccess(ter))
{
return ter; // LCOV_EXCL_LINE
return ter; // LCOV_EXCL_LINE
}
// clang-format on
view.update(sleDest);
}

View File

@@ -163,25 +163,20 @@ public:
{spook, 1}}),
ter(temBAD_QUORUM));
// clang-format off
// Make a signer list that's too big. Should fail.
Account const spare("spare", KeyType::secp256k1);
env(signers(
alice,
1,
std::vector<signer>{{bogie, 1}, {demon, 1}, {ghost, 1},
{haunt, 1}, {jinni, 1}, {phase, 1},
{shade, 1}, {spook, 1}, {spare, 1},
{acc10, 1}, {acc11, 1}, {acc12, 1},
{acc13, 1}, {acc14, 1}, {acc15, 1},
{acc16, 1}, {acc17, 1}, {acc18, 1},
{acc19, 1}, {acc20, 1}, {acc21, 1},
{acc22, 1}, {acc23, 1}, {acc24, 1},
{acc25, 1}, {acc26, 1}, {acc27, 1},
{acc28, 1}, {acc29, 1}, {acc30, 1},
{acc31, 1}, {acc32, 1}, {acc33, 1}}),
std::vector<signer>{
{bogie, 1}, {demon, 1}, {ghost, 1}, {haunt, 1}, {jinni, 1}, {phase, 1},
{shade, 1}, {spook, 1}, {spare, 1}, {acc10, 1}, {acc11, 1}, {acc12, 1},
{acc13, 1}, {acc14, 1}, {acc15, 1}, {acc16, 1}, {acc17, 1}, {acc18, 1},
{acc19, 1}, {acc20, 1}, {acc21, 1}, {acc22, 1}, {acc23, 1}, {acc24, 1},
{acc25, 1}, {acc26, 1}, {acc27, 1}, {acc28, 1}, {acc29, 1}, {acc30, 1},
{acc31, 1}, {acc32, 1}, {acc33, 1},
}),
ter(temMALFORMED));
// clang-format on
env.close();
env.require(owners(alice, 0));
}

View File

@@ -295,8 +295,6 @@ public:
{
testcase("Direct Step");
// clang-format off
// Set up a payment through four accounts: alice -> bob -> carol -> dan
// For each relevant trust line on the path, there are three things that can vary:
// 1) input quality
@@ -305,8 +303,6 @@ public:
// For each account, there is one thing that can vary:
// 1) transfer rate
// clang-format on
using namespace jtx;
auto const currency = to_currency("USD");
@@ -385,14 +381,12 @@ public:
testcase("Book Step");
using namespace jtx;
// clang-format off
// Setup a payment through an offer:
// alice (USD/bob) -> bob -> (USD/bob)|(EUR/carol) -> carol -> dan
// For each relevant trust line, vary input quality, output quality, debt direction. For
// each account, vary transfer rate.
// Setup a payment through an offer: alice (USD/bob) -> bob -> (USD/bob)|(EUR/carol) -> carol -> dan
// For each relevant trust line, vary input quality, output quality, debt direction.
// For each account, vary transfer rate.
// The USD/bob|EUR/carol offer owner is "Oscar"
// clang-format on
// The USD/bob|EUR/carol offer owner is "Oscar".
int const numTestIterations = reqNumIterations.value_or(100);

View File

@@ -261,9 +261,7 @@ public:
env(noop(alice), fee(baseFee * 2.0), queued);
// Queue is full now.
// clang-format off
checkMetrics(*this, env, 6, 6, 4, 3, txFeeLevelByAccount(env, daria) + 1);
// clang-format on
// Try to add another transaction with the default (low) fee,
// it should fail because the queue is full.
env(noop(charlie), ter(telCAN_NOT_QUEUE_FULL));
@@ -274,18 +272,22 @@ public:
env(noop(charlie), fee(baseFee * 10), queued);
// Queue is still full, of course, but the min fee has gone up
// clang-format off
checkMetrics(*this, env, 6, 6, 4, 3, txFeeLevelByAccount(env, elmo) + 1);
// clang-format on
// Close out the ledger, the transactions are accepted, the
// queue is cleared, then the localTxs are retried. At this
// point, daria's transaction that was dropped from the queue
// is put back in. Neat.
env.close();
// clang-format off
checkMetrics(*this, env, 2, 8, 5, 4, baseFeeLevel.fee(), calcMedFeeLevel(FeeLevel64{baseFeeLevel.fee() * largeFeeMultiplier}));
// clang-format on
checkMetrics(
*this,
env,
2,
8,
5,
4,
baseFeeLevel.fee(),
calcMedFeeLevel(FeeLevel64{baseFeeLevel.fee() * largeFeeMultiplier}));
env.close();
checkMetrics(*this, env, 0, 10, 2, 5);
@@ -750,15 +752,13 @@ public:
env.close();
// alice's transaction is still hanging around
// clang-format off
checkMetrics(*this, env, 1, 8, 5, 4, baseFeeLevel.fee(), baseFeeLevel.fee() * largeFeeMultiplier);
// clang-format on
checkMetrics(
*this, env, 1, 8, 5, 4, baseFeeLevel.fee(), baseFeeLevel.fee() * largeFeeMultiplier);
BEAST_EXPECT(env.seq(alice) == 3);
constexpr auto anotherLargeFeeMultiplier = 800;
auto const anotherLargeFee = baseFee * anotherLargeFeeMultiplier;
// Keep alice's transaction waiting.
// clang-format off
env(noop(bob), fee(anotherLargeFee), queued);
env(noop(charlie), fee(anotherLargeFee), queued);
env(noop(daria), fee(anotherLargeFee), queued);
@@ -766,24 +766,36 @@ public:
env(noop(edgar), fee(anotherLargeFee), queued);
env(noop(felicia), fee(anotherLargeFee - 1), queued);
env(noop(felicia), fee(anotherLargeFee - 1), seq(env.seq(felicia) + 1), queued);
checkMetrics(*this, env, 8, 8, 5, 4, baseFeeLevel.fee() + 1, baseFeeLevel.fee() * largeFeeMultiplier);
// clang-format on
checkMetrics(
*this,
env,
8,
8,
5,
4,
baseFeeLevel.fee() + 1,
baseFeeLevel.fee() * largeFeeMultiplier);
env.close();
// alice's transaction expired without getting
// into the ledger, so her transaction is gone,
// though one of felicia's is still in the queue.
// clang-format off
checkMetrics(*this, env, 1, 10, 6, 5, baseFeeLevel.fee(), baseFeeLevel.fee() * largeFeeMultiplier);
// clang-format on
checkMetrics(
*this, env, 1, 10, 6, 5, baseFeeLevel.fee(), baseFeeLevel.fee() * largeFeeMultiplier);
BEAST_EXPECT(env.seq(alice) == 3);
BEAST_EXPECT(env.seq(felicia) == 7);
env.close();
// And now the queue is empty
// clang-format off
checkMetrics(*this, env, 0, 12, 1, 6, baseFeeLevel.fee(), baseFeeLevel.fee() * anotherLargeFeeMultiplier);
// clang-format on
checkMetrics(
*this,
env,
0,
12,
1,
6,
baseFeeLevel.fee(),
baseFeeLevel.fee() * anotherLargeFeeMultiplier);
BEAST_EXPECT(env.seq(alice) == 3);
BEAST_EXPECT(env.seq(felicia) == 8);
}
@@ -857,9 +869,7 @@ public:
feeCarol = (feeCarol + 1) * 125 / 100;
++seqCarol;
}
// clang-format off
checkMetrics(*this, env, 6, 6, 4, 3, (baseFeeLevel.fee() * aliceFeeMultiplier) + 1);
// clang-format on
// Carol submits high enough to beat Bob's average fee which kicks
// out Bob's queued transaction. However Bob's transaction stays
@@ -1505,9 +1515,7 @@ public:
env.close();
// If not for the maximum, the per ledger would be 11.
// clang-format off
checkMetrics(*this, env, 0, 10, 0, 5, baseFeeLevel.fee(), calcMedFeeLevel(medFeeLevel));
// clang-format on
}
try

View File

@@ -559,7 +559,6 @@ allPathElements(AccountID const& a, Issue const& iss);
namespace check {
/** Create a check. */
// clang-format off
template <typename A>
requires std::is_same_v<A, AccountID>
Json::Value
@@ -572,7 +571,6 @@ create(A const& account, A const& dest, STAmount const& sendMax)
jv[sfTransactionType.jsonName] = jss::CheckCreate;
return jv;
}
// clang-format on
inline Json::Value
create(jtx::Account const& account, jtx::Account const& dest, STAmount const& sendMax)

View File

@@ -42,20 +42,14 @@ public:
// Empty string
check("", "");
// clang-format off
check(
"RTXP/1.1,RTXP/1.2,RTXP/1.3,XRPL/2.1,XRPL/2.0,/XRPL/3.0",
"XRPL/2.0,XRPL/2.1");
check(
"RTXP/0.9,RTXP/1.01,XRPL/0.3,XRPL/2.01,websocket",
"");
check("RTXP/1.1,RTXP/1.2,RTXP/1.3,XRPL/2.1,XRPL/2.0,/XRPL/3.0", "XRPL/2.0,XRPL/2.1");
check("RTXP/0.9,RTXP/1.01,XRPL/0.3,XRPL/2.01,websocket", "");
check(
"XRPL/2.0,XRPL/2.0,XRPL/19.4,XRPL/7.89,XRPL/XRPL/3.0,XRPL/2.01",
"XRPL/2.0,XRPL/7.89,XRPL/19.4");
check(
"XRPL/2.0,XRPL/3.0,XRPL/4,XRPL/,XRPL,OPT XRPL/2.2,XRPL/5.67",
"XRPL/2.0,XRPL/3.0,XRPL/5.67");
// clang-format on
}
{

View File

@@ -87,11 +87,7 @@ public:
: sink_(partition, threshold, suite), journal_(sink_)
{
}
// Clang 10.0.0 and 10.0.1 disagree about formatting operator&
// TBD Re-enable formatting when we upgrade to clang 11
// clang-format off
operator beast::Journal &()
// clang-format on
operator beast::Journal&()
{
return journal_;
}

View File

@@ -112,11 +112,12 @@ sizedItems
{SizedItem::ramSizeGB, {{ 6, 8, 12, 24, 0 }}},
{SizedItem::accountIdCacheSize, {{ 20047, 50053, 77081, 150061, 300007 }}}
}};
// clang-format on
// Ensure that the order of entries in the table corresponds to the
// order of entries in the enum:
static_assert(
[]() constexpr->bool {
[]() constexpr -> bool {
std::underlying_type_t<SizedItem> idx = 0;
for (auto const& i : sizedItems)
@@ -130,7 +131,6 @@ static_assert(
return true;
}(),
"Mismatch between sized item enum & array indices");
// clang-format on
//
// TODO: Check permissions on config file before using it.

View File

@@ -17,13 +17,10 @@ namespace xrpl {
it may not contain any duplicates!)
*/
// clang-format off
constexpr ProtocolVersion const supportedProtocolList[]
{
constexpr ProtocolVersion const supportedProtocolList[]{
{2, 1},
{2, 2}
{2, 2},
};
// clang-format on
// This ugly construct ensures that supportedProtocolList is sorted in strictly
// ascending order and doesn't contain any duplicates.