From fe2e5ce649d1a235368d7e24d7898eae51db4eeb Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Fri, 3 Apr 2026 12:33:14 -0400 Subject: [PATCH] fix clang-tidy issues --- .../tx/transactors/escrow/EscrowFinish.cpp | 2 +- src/test/app/EscrowSmart_test.cpp | 19 ++++++++++--------- src/test/app/wasm_fixtures/fixtures.cpp | 2 +- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/libxrpl/tx/transactors/escrow/EscrowFinish.cpp b/src/libxrpl/tx/transactors/escrow/EscrowFinish.cpp index c2b04a08c8..0154a42af3 100644 --- a/src/libxrpl/tx/transactors/escrow/EscrowFinish.cpp +++ b/src/libxrpl/tx/transactors/escrow/EscrowFinish.cpp @@ -384,7 +384,7 @@ EscrowFinish::doApply() JLOG(j_.trace()) << "The escrow has a finish function, running WASM code..."; // WASM execution auto const wasmStr = slep->getFieldVL(sfFinishFunction); - std::vector wasm(wasmStr.begin(), wasmStr.end()); + std::vector const wasm(wasmStr.begin(), wasmStr.end()); WasmHostFunctionsImpl ledgerDataProvider(ctx_, k); diff --git a/src/test/app/EscrowSmart_test.cpp b/src/test/app/EscrowSmart_test.cpp index 93f6095028..c12313c0a8 100644 --- a/src/test/app/EscrowSmart_test.cpp +++ b/src/test/app/EscrowSmart_test.cpp @@ -489,7 +489,7 @@ struct EscrowSmart_test : public beast::unit_test::suite std::uint32_t const allowance = 467; auto escrowCreate = escrow::create(alice, carol, XRP(1000)); auto [createFee, finishFee] = [&]() { - Env env(*this, features); + Env const env(*this, features); auto createFee = env.current()->fees().base * 10 + ledgerSqnWasmHex.size() / 2 * 5; auto finishFee = env.current()->fees().base + (allowance * env.current()->fees().gasPrice) / MICRO_DROPS_PER_DROP + 1; @@ -760,7 +760,8 @@ struct EscrowSmart_test : public beast::unit_test::suite auto const seq = env.seq(alice); BEAST_EXPECT(env.ownerCount(alice) == 0); auto escrowCreate = escrow::create(alice, alice, XRP(1000)); - XRPAmount txnFees = env.current()->fees().base * 10 + updateDataWasmHex.size() / 2 * 5; + XRPAmount const txnFees = + env.current()->fees().base * 10 + updateDataWasmHex.size() / 2 * 5; env(escrowCreate, escrow::finish_function(updateDataWasmHex), escrow::finish_time(env.now() + 2s), @@ -816,7 +817,7 @@ struct EscrowSmart_test : public beast::unit_test::suite uint64_t const allowance = 467; auto escrowCreate = escrow::create(alice, carol, XRP(1000)); auto createFee = [&]() { - Env env(*this, features); + Env const env(*this, features); auto createFee = env.current()->fees().base * 10 + ledgerSqnWasmHex.size() / 2 * 5; return createFee; }(); @@ -853,7 +854,7 @@ struct EscrowSmart_test : public beast::unit_test::suite env.close(); auto const bigAllowance = 996'433; - uint64_t partialFeeCalc = + uint64_t const partialFeeCalc = (static_cast(bigAllowance) * 1'000'000) / MICRO_DROPS_PER_DROP + 1; // to avoid an overflow auto finishFee = env.current()->fees().base + partialFeeCalc; @@ -910,7 +911,7 @@ struct EscrowSmart_test : public beast::unit_test::suite auto const seq = env.seq(alice); BEAST_EXPECT(env.ownerCount(alice) == 0); auto escrowCreate = escrow::create(alice, carol, XRP(1000)); - XRPAmount txnFees = + XRPAmount const txnFees = env.current()->fees().base * 10 + allHostFunctionsWasmHex.size() / 2 * 5; env(escrowCreate, escrow::finish_function(allHostFunctionsWasmHex), @@ -991,7 +992,7 @@ struct EscrowSmart_test : public beast::unit_test::suite BEAST_EXPECT(env.ownerCount(alice) == 2); // set up a bunch of objects to check their keylets - AMM amm(env, carol, XRP(10), carol["USD"](1000)); + AMM const amm(env, carol, XRP(10), carol["USD"](1000)); env(check::create(alice, carol, XRP(100))); env(credentials::create(alice, alice, "termsandconditions")); env(delegate::set(alice, carol, {"TrustSet"})); @@ -1004,11 +1005,11 @@ 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 credentials{{alice, "first credential"}}; + pdomain::Credentials const credentials{{alice, "first credential"}}; env(pdomain::setTx(alice, credentials)); env(signers(alice, 1, {{carol, 1}})); env(ticket::create(alice, 1)); - Vault vault{env}; + Vault const vault{env}; auto [tx, _keylet] = vault.create({.owner = alice, .asset = xrpIssue()}); env(tx); env.close(); @@ -1017,7 +1018,7 @@ struct EscrowSmart_test : public beast::unit_test::suite if (BEAST_EXPECTS(env.seq(alice) == 20, std::to_string(env.seq(alice)))) { auto const seq = env.seq(alice); - XRPAmount txnFees = + XRPAmount const txnFees = env.current()->fees().base * 10 + allKeyletsWasmHex.size() / 2 * 5; env(escrow::create(alice, carol, XRP(1000)), escrow::finish_function(allKeyletsWasmHex), diff --git a/src/test/app/wasm_fixtures/fixtures.cpp b/src/test/app/wasm_fixtures/fixtures.cpp index 99cc8e9644..ab86194ce7 100644 --- a/src/test/app/wasm_fixtures/fixtures.cpp +++ b/src/test/app/wasm_fixtures/fixtures.cpp @@ -88,7 +88,7 @@ generateDataBlob(uint32_t data_size) appendBytes(wasm, FUNC_TYPE0); // Memory Section: must be large enough for data_size - uint32_t pages = (data_size + 65535) / 65536; + uint32_t const pages = (data_size + 65535) / 65536; std::vector mem_p; pushLeb128(mem_p, 1); // 1 memory defined mem_p.push_back(0x00); // Flags (minimum only)