chore: address review nits (safeCast, whitespace, comments)

This commit is contained in:
Denis Angell
2026-06-30 09:15:21 -04:00
parent 095389672a
commit cc348e7745
4 changed files with 9 additions and 6 deletions

View File

@@ -310,8 +310,8 @@ constexpr std::size_t kPermissionMaxSize = 10;
/** The maximum number of transactions that can be in a batch. */
constexpr std::size_t kMaxBatchTxCount = 8;
/** The maximum number of batch signers. */
/** The maximum number of batch signers. */
constexpr std::size_t kMaxBatchSigners = kMaxBatchTxCount * 3;
/** Length of a secp256k1 scalar in bytes. */

View File

@@ -24,6 +24,10 @@ public:
ApplyFlags flags,
beast::Journal journal = beast::Journal{beast::Journal::getNullSink()});
// Convenience constructor used only by tests that build an ApplyContext
// directly (e.g. invariant checks). Production always uses the parentBatchId
// constructor above; this one fixes parentBatchId to std::nullopt and so is
// never valid for a batch inner (hence the TapBatch assert).
explicit ApplyContext(
ServiceRegistry& registry,
OpenView& base,

View File

@@ -755,7 +755,7 @@ isBatchRawTransactionOkay(STObject const& st, std::string& reason)
// sfRawTransactions only appears on a Batch. passesLocalChecks runs on
// unverified user and peer input, so reject (rather than assert) a non-batch
// transaction that carries it.
if (safeCast<TxType>(st.getFieldU16(sfTransactionType)) != ttBATCH)
if (st.getFieldU16(sfTransactionType) != ttBATCH)
{
reason = "Only Batch transactions may contain raw transactions.";
return false;

View File

@@ -484,9 +484,8 @@ Batch::preflightSigValidated(PreflightContext const& ctx)
}
}
// Every required signer must be matched. This is cheaper than the signature
// check below, so verify it first. Also covers sfBatchSigners being absent
// while inner txns require signers (numReqSignersMatched stays 0).
// Every required signer must be matched. Also covers sfBatchSigners being
// absent while inner txns require signers (numReqSignersMatched stays 0).
if (numReqSignersMatched != requiredSigners.size())
{
JLOG(ctx.j.debug()) << "BatchTrace[" << parentBatchId << "]: "