fix clang-tidy

This commit is contained in:
Mayukha Vadari
2026-05-26 20:09:46 -04:00
parent 3b328cfc45
commit 2307cfdc5a
4 changed files with 16 additions and 8 deletions

View File

@@ -133,9 +133,8 @@ EscrowCreate::calculateBaseFee(ReadView const& view, STTx const& tx)
bool
EscrowCreate::checkExtraFeatures(PreflightContext const& ctx)
{
return !(
(ctx.tx.isFieldPresent(sfFinishFunction) || ctx.tx.isFieldPresent(sfData)) &&
!ctx.rules.enabled(featureSmartEscrow));
return (!ctx.tx.isFieldPresent(sfFinishFunction) && !ctx.tx.isFieldPresent(sfData)) ||
ctx.rules.enabled(featureSmartEscrow);
}
NotTEC

View File

@@ -18,6 +18,7 @@
#include <xrpl/protocol/AccountID.h>
#include <xrpl/protocol/Concepts.h>
#include <xrpl/protocol/Feature.h>
#include <xrpl/protocol/Fees.h>
#include <xrpl/protocol/Indexes.h>
#include <xrpl/protocol/Issue.h>
#include <xrpl/protocol/MPTIssue.h>
@@ -37,6 +38,7 @@
#include <limits>
#include <memory>
#include <optional>
#include <string>
#include <system_error>
#include <variant>
#include <vector>
@@ -167,7 +169,8 @@ EscrowFinish::calculateBaseFee(ReadView const& view, STTx const& tx)
// The extra fee is the allowance in drops, rounded up to the nearest
// whole drop.
// Integer math rounds down by default, so we add 1 to round up.
uint64_t const allowanceFee = ((*allowance) * view.fees().gasPrice) / microDropsPerDrop + 1;
uint64_t const allowanceFee =
(((*allowance) * view.fees().gasPrice) / microDropsPerDrop) + 1;
extraFee += allowanceFee;
}
return Transactor::calculateBaseFee(view, tx) + extraFee;

View File

@@ -5,7 +5,6 @@
#include <test/jtx/TestHelpers.h>
#include <test/jtx/amount.h>
#include <test/jtx/balance.h>
#include <test/jtx/check.h>
#include <test/jtx/credentials.h>
#include <test/jtx/delegate.h>
#include <test/jtx/deposit.h>
@@ -14,6 +13,7 @@
#include <test/jtx/escrow.h>
#include <test/jtx/fee.h>
#include <test/jtx/mpt.h>
#include <test/jtx/multisign.h>
#include <test/jtx/noop.h>
#include <test/jtx/offer.h>
#include <test/jtx/pay.h>
@@ -27,7 +27,9 @@
#include <xrpld/core/Config.h>
#include <xrpl/basics/StringUtilities.h>
#include <xrpl/basics/base_uint.h>
#include <xrpl/basics/strHex.h>
#include <xrpl/beast/unit_test/suite.h>
#include <xrpl/beast/utility/Journal.h>
#include <xrpl/core/ServiceRegistry.h>
@@ -49,6 +51,8 @@
#include <optional>
#include <source_location>
#include <string>
#include <utility>
#include <vector>
namespace xrpl::test {
@@ -917,7 +921,7 @@ struct EscrowSmart_test : public beast::unit_test::Suite
auto const bigAllowance = 996'433;
uint64_t const partialFeeCalc =
(static_cast<uint64_t>(bigAllowance) * 1'000'000) / microDropsPerDrop + 1;
((static_cast<uint64_t>(bigAllowance) * 1'000'000) / microDropsPerDrop) + 1;
auto finishFee = env.current()->fees().base + partialFeeCalc;
BEAST_EXPECT(finishFee.drops() > bigAllowance);

View File

@@ -2,7 +2,9 @@
#include <test/app/wasm_fixtures/fixtures.h>
#include <cstdint>
#include <string>
#include <vector>
namespace wasm_constants {
@@ -15,10 +17,10 @@ appendU32Leb(std::vector<uint8_t>& out, uint32_t value)
{
auto byte = static_cast<uint8_t>(value & 0x7f);
value >>= 7;
if (value)
if (value != 0u)
byte |= 0x80;
out.push_back(byte);
} while (value);
} while (value != 0u);
}
void