Add Antithesis intrumentation (#5042)

* Copy Antithesis SDK version 0.4.0 to directory external/
* Add build option `voidstar` to enable instrumentation with Antithesis SDK
* Define instrumentation macros ASSERT and UNREACHABLE in terms of regular C assert
* Replace asserts with named ASSERT or UNREACHABLE
* Add UNREACHABLE to LogicError
* Document instrumentation macros in CONTRIBUTING.md
This commit is contained in:
Bronek Kozicki
2024-12-03 14:52:21 -05:00
committed by Ed Hennis
parent f64cf9187a
commit d7e949193f
261 changed files with 3827 additions and 1034 deletions

View File

@@ -53,7 +53,9 @@ toSTAmount(XRPAmount const& xrp)
inline STAmount
toSTAmount(XRPAmount const& xrp, Issue const& iss)
{
assert(isXRP(iss.account) && isXRP(iss.currency));
ASSERT(
isXRP(iss.account) && isXRP(iss.currency),
"ripple::toSTAmount : is XRP");
return toSTAmount(xrp);
}
@@ -72,12 +74,14 @@ template <>
inline IOUAmount
toAmount<IOUAmount>(STAmount const& amt)
{
assert(amt.mantissa() < std::numeric_limits<std::int64_t>::max());
ASSERT(
amt.mantissa() < std::numeric_limits<std::int64_t>::max(),
"ripple::toAmount<IOUAmount> : maximum mantissa");
bool const isNeg = amt.negative();
std::int64_t const sMant =
isNeg ? -std::int64_t(amt.mantissa()) : amt.mantissa();
assert(!isXRP(amt));
ASSERT(!isXRP(amt), "ripple::toAmount<IOUAmount> : is not XRP");
return IOUAmount(sMant, amt.exponent());
}
@@ -85,12 +89,14 @@ template <>
inline XRPAmount
toAmount<XRPAmount>(STAmount const& amt)
{
assert(amt.mantissa() < std::numeric_limits<std::int64_t>::max());
ASSERT(
amt.mantissa() < std::numeric_limits<std::int64_t>::max(),
"ripple::toAmount<XRPAmount> : maximum mantissa");
bool const isNeg = amt.negative();
std::int64_t const sMant =
isNeg ? -std::int64_t(amt.mantissa()) : amt.mantissa();
assert(isXRP(amt));
ASSERT(isXRP(amt), "ripple::toAmount<XRPAmount> : is XRP");
return XRPAmount(sMant);
}