Rename XRPL_ASSERT2 to XRPL_ASSERT_PARTS, and document it

This commit is contained in:
Ed Hennis
2025-05-08 18:28:01 -04:00
parent 8483115637
commit f91a737184
2 changed files with 6 additions and 3 deletions

View File

@@ -39,13 +39,16 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#endif
#define XRPL_ASSERT ALWAYS_OR_UNREACHABLE
#define XRPL_ASSERT2(cond, location, message, ...) \
XRPL_ASSERT(cond, location " : " message)
#define XRPL_ASSERT_PARTS(cond, function, description, ...) \
XRPL_ASSERT(cond, function " : " description)
// How to use the instrumentation macros:
//
// * XRPL_ASSERT if cond must be true but the line might not be reached during
// fuzzing. Same like `assert` in normal use.
// * XRPL_ASSERT_PARTS is for convenience, and works like XRPL_ASSERT, but
// splits the message param into "function" and "description", then joins
// them with " : " before passing to XRPL_ASSERT.
// * ALWAYS if cond must be true _and_ the line must be reached during fuzzing.
// Same like `assert` in normal use.
// * REACHABLE if the line must be reached during fuzzing

View File

@@ -230,7 +230,7 @@ LoanPay::doApply()
// Move funds
STAmount const paidToVault(asset, totalPaidToVault);
STAmount const paidToBroker(asset, totalFee);
XRPL_ASSERT2(
XRPL_ASSERT_PARTS(
paidToVault + paidToBroker == amount,
"ripple::LoanPay::doApply",
"correct payment totals");