Implement Lending Protocol (unsupported) (#5270)

- Spec: XLS-66
- Introduces amendment "LendingProtocol", but leaves it UNSUPPORTED to
  allow for standalone testing, future development work, and potential
  bug fixes.
- AccountInfo RPC will indicate the type of pseudo-account when
  appropriate.
- Refactors and improves several existing classes and functional areas,
  including Number, STAmount, STObject, json_value, Asset, directory
  handling, View helper functions, and unit test helpers.
This commit is contained in:
Ed Hennis
2025-12-02 11:38:17 -05:00
committed by GitHub
parent c9f17dd85d
commit 6c67f1f525
86 changed files with 18810 additions and 553 deletions

View File

@@ -427,14 +427,16 @@ Env::postconditions(
ParsedResult const& parsed,
Json::Value const& jr)
{
bool bad = !test.expect(parsed.ter, "apply: No ter result!");
auto const line = jt.testLine ? " (" + to_string(*jt.testLine) + ")" : "";
bool bad = !test.expect(parsed.ter, "apply: No ter result!" + line);
bad =
(jt.ter && parsed.ter &&
!test.expect(
*parsed.ter == *jt.ter,
"apply: Got " + transToken(*parsed.ter) + " (" +
transHuman(*parsed.ter) + "); Expected " +
transToken(*jt.ter) + " (" + transHuman(*jt.ter) + ")"));
transToken(*jt.ter) + " (" + transHuman(*jt.ter) + ")" +
line));
using namespace std::string_literals;
bad = (jt.rpcCode &&
!test.expect(
@@ -446,21 +448,21 @@ Env::postconditions(
: "NO RESULT") +
" (" + parsed.rpcMessage + "); Expected " +
RPC::get_error_info(jt.rpcCode->first).token.c_str() + " (" +
jt.rpcCode->second + ")")) ||
jt.rpcCode->second + ")" + line)) ||
bad;
// If we have an rpcCode (just checked), then the rpcException check is
// optional - the 'error' field may not be defined, but if it is, it must
// match rpcError.
bad =
(jt.rpcException &&
!test.expect(
(jt.rpcCode && parsed.rpcError.empty()) ||
(parsed.rpcError == jt.rpcException->first &&
(!jt.rpcException->second ||
parsed.rpcException == *jt.rpcException->second)),
"apply: Got RPC result "s + parsed.rpcError + " (" +
parsed.rpcException + "); Expected " + jt.rpcException->first +
" (" + jt.rpcException->second.value_or("n/a") + ")")) ||
bad = (jt.rpcException &&
!test.expect(
(jt.rpcCode && parsed.rpcError.empty()) ||
(parsed.rpcError == jt.rpcException->first &&
(!jt.rpcException->second ||
parsed.rpcException == *jt.rpcException->second)),
"apply: Got RPC result "s + parsed.rpcError + " (" +
parsed.rpcException + "); Expected " +
jt.rpcException->first + " (" +
jt.rpcException->second.value_or("n/a") + ")" + line)) ||
bad;
if (bad)
{