fix clang-tidy issues

This commit is contained in:
Mayukha Vadari
2026-07-24 14:16:36 -04:00
parent c145201538
commit 083986ab82
9 changed files with 56 additions and 36 deletions

View File

@@ -13,6 +13,7 @@
#include <xrpl/protocol/TxMeta.h>
#include <cstddef>
#include <cstdint>
#include <functional>
#include <optional>

View File

@@ -16,6 +16,7 @@
#include <xrpl/protocol/XRPAmount.h>
#include <cstddef>
#include <cstdint>
#include <functional>
#include <map>
#include <optional>

View File

@@ -23,6 +23,8 @@
#include <xrpl/protocol/TER.h>
#include <xrpl/protocol/UintTypes.h>
#include <cstdint>
namespace xrpl {
template <ValidIssueType T>

View File

@@ -15,6 +15,7 @@
#include <xrpl/protocol/XRPAmount.h>
#include <cstddef>
#include <cstdint>
#include <functional>
#include <optional>
#include <utility>

View File

@@ -1516,7 +1516,7 @@ Transactor::processPersistentChanges(TER result, XRPAmount fee)
auto const type = after->getType();
if (typesToCollect.contains(type) && type == ltESCROW &&
after->isFieldPresent(sfData))
modifiedObjects[type].push_back({index, after});
modifiedObjects[type].emplace_back(index, after);
}
});
}

View File

@@ -92,8 +92,10 @@ EscrowCreate::checkExtraFeatures(PreflightContext const& ctx)
// Only require featureMPTokensV1 when the escrow amount is an MPT and
// fixCleanup3_2_0 is active; XRP/IOU escrows are unaffected by this gate.
if (ctx.rules.enabled(fixCleanup3_2_0) && ctx.tx[sfAmount].holds<MPTIssue>())
{
if (!ctx.rules.enabled(featureMPTokensV1))
return false;
}
return (!ctx.tx.isFieldPresent(sfBytecode) && !ctx.tx.isFieldPresent(sfData)) ||
ctx.rules.enabled(featureSmartEscrow);

View File

@@ -1073,7 +1073,8 @@ struct EscrowSmart_test : public beast::unit_test::Suite
env(token::createOffer(carol, tokenId, XRP(100)), token::Owner(alice));
env(offer(alice, carol["GBP"](0.1), XRP(100)));
env(paychan::create(alice, carol, XRP(1000), 100s, alice.pk()));
pdomain::Credentials const credentials{{alice, "first credential"}};
pdomain::Credentials const credentials{
{.issuer = alice, .credType = "first credential"}};
env(pdomain::setTx(alice, credentials));
env(signers(alice, 1, {{carol, 1}}));
env(ticket::create(alice, 1));
@@ -1191,41 +1192,47 @@ struct EscrowSmart_test : public beast::unit_test::Suite
std::vector<TestCase> const testCases = {
// Code blob tests
{TestCase::BlobType::Code,
99'950,
std::nullopt,
ExpectedStatus::Success}, // just under 100kb
{TestCase::BlobType::Code,
99'955,
std::nullopt,
ExpectedStatus::Malformed}, // just over 100kb
{TestCase::BlobType::Code, 200'000, 10'000'000, ExpectedStatus::Success}, // ~200kb
{TestCase::BlobType::Code,
490'000,
10'000'000,
ExpectedStatus::Success}, // just under 1MB JSON
{TestCase::BlobType::Code,
999'999,
10'000'000,
ExpectedStatus::Crash}, // just over 1MB JSON
{.type = TestCase::BlobType::Code,
.size = 99'950,
.sizeLimit = std::nullopt,
.expected = ExpectedStatus::Success}, // just under 100kb
{.type = TestCase::BlobType::Code,
.size = 99'955,
.sizeLimit = std::nullopt,
.expected = ExpectedStatus::Malformed}, // just over 100kb
{.type = TestCase::BlobType::Code,
.size = 200'000,
.sizeLimit = 10'000'000,
.expected = ExpectedStatus::Success}, // ~200kb
{.type = TestCase::BlobType::Code,
.size = 490'000,
.sizeLimit = 10'000'000,
.expected = ExpectedStatus::Success}, // just under 1MB JSON
{.type = TestCase::BlobType::Code,
.size = 999'999,
.sizeLimit = 10'000'000,
.expected = ExpectedStatus::Crash}, // just over 1MB JSON
// Data blob tests
{TestCase::BlobType::Data,
99'939,
std::nullopt,
ExpectedStatus::Success}, // just under 100kb
{TestCase::BlobType::Data,
99'941,
std::nullopt,
ExpectedStatus::Malformed}, // just over 100kb
{TestCase::BlobType::Data, 200'000, 10'000'000, ExpectedStatus::Success}, // ~200kb
{TestCase::BlobType::Data,
490'000,
10'000'000,
ExpectedStatus::Success}, // just under 1MB JSON
{TestCase::BlobType::Data,
999'950,
10'000'000,
ExpectedStatus::Crash}, // just over 1MB JSON
{.type = TestCase::BlobType::Data,
.size = 99'939,
.sizeLimit = std::nullopt,
.expected = ExpectedStatus::Success}, // just under 100kb
{.type = TestCase::BlobType::Data,
.size = 99'941,
.sizeLimit = std::nullopt,
.expected = ExpectedStatus::Malformed}, // just over 100kb
{.type = TestCase::BlobType::Data,
.size = 200'000,
.sizeLimit = 10'000'000,
.expected = ExpectedStatus::Success}, // ~200kb
{.type = TestCase::BlobType::Data,
.size = 490'000,
.sizeLimit = 10'000'000,
.expected = ExpectedStatus::Success}, // just under 1MB JSON
{.type = TestCase::BlobType::Data,
.size = 999'950,
.sizeLimit = 10'000'000,
.expected = ExpectedStatus::Crash}, // just over 1MB JSON
};
for (auto const& tc : testCases)

View File

@@ -2,8 +2,11 @@
#include <test/jtx/Account.h>
#include <test/jtx/Env.h>
#include <test/jtx/JTx.h>
#include <test/jtx/TestHelpers.h>
#include <xrpl/basics/Slice.h>
#include <xrpl/basics/strHex.h>
#include <xrpl/json/json_value.h>
#include <xrpl/protocol/AccountID.h>
#include <xrpl/protocol/Rate.h>
@@ -11,7 +14,9 @@
#include <xrpl/protocol/STAmount.h>
#include <array>
#include <cstddef>
#include <cstdint>
#include <string>
#include <utility>
/**

View File

@@ -8,6 +8,7 @@
#include <xrpl/core/NetworkIDService.h>
#include <xrpl/core/ServiceRegistry.h>
#include <xrpl/ledger/PendingSaves.h>
#include <xrpl/protocol/XRPAmount.h>
#include <xrpl/server/LoadFeeTrack.h>
#include <boost/asio/io_context.hpp>