From 195904574c6d3a1fdff15bf4c984f70e4f3d471e Mon Sep 17 00:00:00 2001 From: Denis Angell Date: Thu, 9 Nov 2023 12:25:09 +0100 Subject: [PATCH] Change TER response codes from `_XRP` to `_NATIVE`. (#184) * Change `_XRP` response codes to `_NATIVE` * Update ServerDefinitions_test.cpp --- src/ripple/app/tx/impl/Payment.cpp | 26 ++++++++++++------------- src/ripple/protocol/TER.h | 12 ++++++------ src/ripple/protocol/impl/TER.cpp | 18 ++++++++--------- src/test/app/AccountDelete_test.cpp | 4 ++-- src/test/app/PayStrand_test.cpp | 4 ++-- src/test/app/TrustAndBalance_test.cpp | 2 +- src/test/rpc/AccountTx_test.cpp | 4 ++-- src/test/rpc/ServerDefinitions_test.cpp | 12 ++++++------ 8 files changed, 41 insertions(+), 41 deletions(-) diff --git a/src/ripple/app/tx/impl/Payment.cpp b/src/ripple/app/tx/impl/Payment.cpp index c1e7b037f..c46bfe704 100644 --- a/src/ripple/app/tx/impl/Payment.cpp +++ b/src/ripple/app/tx/impl/Payment.cpp @@ -86,7 +86,7 @@ Payment::preflight(PreflightContext const& ctx) auto const& uSrcCurrency = maxSourceAmount.getCurrency(); auto const& uDstCurrency = saDstAmount.getCurrency(); - // isZero() is XRP. FIX! + // isZero() is XAH. FIX! bool const bXRPDirect = uSrcCurrency.isZero() && uDstCurrency.isZero(); if (!isLegalNet(saDstAmount) || !isLegalNet(maxSourceAmount)) @@ -132,36 +132,36 @@ Payment::preflight(PreflightContext const& ctx) { // Consistent but redundant transaction. JLOG(j.trace()) << "Malformed transaction: " - << "SendMax specified for XRP to XRP."; - return temBAD_SEND_XRP_MAX; + << "SendMax specified for XAH to XAH."; + return temBAD_SEND_NATIVE_MAX; } if (bXRPDirect && bPaths) { - // XRP is sent without paths. + // XAH is sent without paths. JLOG(j.trace()) << "Malformed transaction: " - << "Paths specified for XRP to XRP."; - return temBAD_SEND_XRP_PATHS; + << "Paths specified for XAH to XAH."; + return temBAD_SEND_NATIVE_PATHS; } if (bXRPDirect && partialPaymentAllowed) { // Consistent but redundant transaction. JLOG(j.trace()) << "Malformed transaction: " - << "Partial payment specified for XRP to XRP."; - return temBAD_SEND_XRP_PARTIAL; + << "Partial payment specified for XAH to XAH."; + return temBAD_SEND_NATIVE_PARTIAL; } if (bXRPDirect && limitQuality) { // Consistent but redundant transaction. JLOG(j.trace()) << "Malformed transaction: " - << "Limit quality specified for XRP to XRP."; - return temBAD_SEND_XRP_LIMIT; + << "Limit quality specified for XAH to XAH."; + return temBAD_SEND_NATIVE_LIMIT; } if (bXRPDirect && !defaultPathsAllowed) { // Consistent but redundant transaction. JLOG(j.trace()) << "Malformed transaction: " - << "No ripple direct specified for XRP to XRP."; - return temBAD_SEND_XRP_NO_DIRECT; + << "No ripple direct specified for XAH to XAH."; + return temBAD_SEND_NATIVE_NO_DIRECT; } auto const deliverMin = tx[~sfDeliverMin]; @@ -252,7 +252,7 @@ Payment::preclaim(PreclaimContext const& ctx) // TODO: dedupe // Another transaction could create the account and then this // transaction would succeed. - return tecNO_DST_INSUF_XRP; + return tecNO_DST_INSUF_NATIVE; } } else if ( diff --git a/src/ripple/protocol/TER.h b/src/ripple/protocol/TER.h index 985819e1b..77212d37b 100644 --- a/src/ripple/protocol/TER.h +++ b/src/ripple/protocol/TER.h @@ -97,11 +97,11 @@ enum TEMcodes : TERUnderlyingType { temBAD_PATH, temBAD_PATH_LOOP, temBAD_REGKEY, - temBAD_SEND_XRP_LIMIT, - temBAD_SEND_XRP_MAX, - temBAD_SEND_XRP_NO_DIRECT, - temBAD_SEND_XRP_PARTIAL, - temBAD_SEND_XRP_PATHS, + temBAD_SEND_NATIVE_LIMIT, + temBAD_SEND_NATIVE_MAX, + temBAD_SEND_NATIVE_NO_DIRECT, + temBAD_SEND_NATIVE_PARTIAL, + temBAD_SEND_NATIVE_PATHS, temBAD_SEQUENCE, temBAD_SIGNATURE, temBAD_SRC_ACCOUNT, @@ -276,7 +276,7 @@ enum TECcodes : TERUnderlyingType { tecINSUF_RESERVE_LINE = 122, tecINSUF_RESERVE_OFFER = 123, tecNO_DST = 124, - tecNO_DST_INSUF_XRP = 125, + tecNO_DST_INSUF_NATIVE = 125, tecNO_LINE_INSUF_RESERVE = 126, tecNO_LINE_REDUNDANT = 127, tecPATH_DRY = 128, diff --git a/src/ripple/protocol/impl/TER.cpp b/src/ripple/protocol/impl/TER.cpp index 94adc65a6..2787aef32 100644 --- a/src/ripple/protocol/impl/TER.cpp +++ b/src/ripple/protocol/impl/TER.cpp @@ -47,8 +47,8 @@ transResults() MAKE_ERROR(tecFAILED_PROCESSING, "Failed to correctly process transaction."), MAKE_ERROR(tecINSUF_RESERVE_LINE, "Insufficient reserve to add trust line."), MAKE_ERROR(tecINSUF_RESERVE_OFFER, "Insufficient reserve to create offer."), - MAKE_ERROR(tecNO_DST, "Destination does not exist. Send XRP to create it."), - MAKE_ERROR(tecNO_DST_INSUF_XRP, "Destination does not exist. Too little XRP sent to create it."), + MAKE_ERROR(tecNO_DST, "Destination does not exist. Send XAH to create it."), + MAKE_ERROR(tecNO_DST_INSUF_NATIVE, "Destination does not exist. Too little XAH sent to create it."), MAKE_ERROR(tecNO_LINE_INSUF_RESERVE, "No such line. Too little reserve to create it."), MAKE_ERROR(tecNO_LINE_REDUNDANT, "Can't set non-existent line to default."), MAKE_ERROR(tecPATH_DRY, "Path could not send partial amount."), @@ -56,7 +56,7 @@ transResults() MAKE_ERROR(tecNO_ALTERNATIVE_KEY, "The operation would remove the ability to sign transactions with the account."), MAKE_ERROR(tecNO_REGULAR_KEY, "Regular key is not set."), MAKE_ERROR(tecOVERSIZE, "Object exceeded serialization limits."), - MAKE_ERROR(tecUNFUNDED, "Not enough XRP to satisfy the reserve requirement."), + MAKE_ERROR(tecUNFUNDED, "Not enough XAH to satisfy the reserve requirement."), MAKE_ERROR(tecUNFUNDED_ADD, "DEPRECATED."), MAKE_ERROR(tecUNFUNDED_OFFER, "Insufficient balance to fund created offer."), MAKE_ERROR(tecUNFUNDED_PAYMENT, "Insufficient balance to send."), @@ -139,7 +139,7 @@ transResults() MAKE_ERROR(temBAD_AMOUNT, "Can only send positive amounts."), MAKE_ERROR(temBAD_CURRENCY, "Malformed: Bad currency."), MAKE_ERROR(temBAD_EXPIRATION, "Malformed: Bad expiration."), - MAKE_ERROR(temBAD_FEE, "Invalid fee, negative or not XRP."), + MAKE_ERROR(temBAD_FEE, "Invalid fee, negative or not XAH."), MAKE_ERROR(temBAD_ISSUER, "Malformed: Bad issuer."), MAKE_ERROR(temBAD_LIMIT, "Limits must be non-negative."), MAKE_ERROR(temBAD_OFFER, "Malformed: Bad offer."), @@ -147,11 +147,11 @@ transResults() MAKE_ERROR(temBAD_PATH_LOOP, "Malformed: Loop in path."), MAKE_ERROR(temBAD_QUORUM, "Malformed: Quorum is unreachable."), MAKE_ERROR(temBAD_REGKEY, "Malformed: Regular key cannot be same as master key."), - MAKE_ERROR(temBAD_SEND_XRP_LIMIT, "Malformed: Limit quality is not allowed for XRP to XRP."), - MAKE_ERROR(temBAD_SEND_XRP_MAX, "Malformed: Send max is not allowed for XRP to XRP."), - MAKE_ERROR(temBAD_SEND_XRP_NO_DIRECT, "Malformed: No Ripple direct is not allowed for XRP to XRP."), - MAKE_ERROR(temBAD_SEND_XRP_PARTIAL, "Malformed: Partial payment is not allowed for XRP to XRP."), - MAKE_ERROR(temBAD_SEND_XRP_PATHS, "Malformed: Paths are not allowed for XRP to XRP."), + MAKE_ERROR(temBAD_SEND_NATIVE_LIMIT, "Malformed: Limit quality is not allowed for XAH to XAH."), + MAKE_ERROR(temBAD_SEND_NATIVE_MAX, "Malformed: Send max is not allowed for XAH to XAH."), + MAKE_ERROR(temBAD_SEND_NATIVE_NO_DIRECT, "Malformed: No Ripple direct is not allowed for XAH to XAH."), + MAKE_ERROR(temBAD_SEND_NATIVE_PARTIAL, "Malformed: Partial payment is not allowed for XAH to XAH."), + MAKE_ERROR(temBAD_SEND_NATIVE_PATHS, "Malformed: Paths are not allowed for XAH to XAH."), MAKE_ERROR(temBAD_SEQUENCE, "Malformed: Sequence is not in the past."), MAKE_ERROR(temBAD_SIGNATURE, "Malformed: Bad signature."), MAKE_ERROR(temBAD_SIGNER, "Malformed: No signer may duplicate account or other signers."), diff --git a/src/test/app/AccountDelete_test.cpp b/src/test/app/AccountDelete_test.cpp index 88bb11aaf..27d7336ee 100644 --- a/src/test/app/AccountDelete_test.cpp +++ b/src/test/app/AccountDelete_test.cpp @@ -513,12 +513,12 @@ public: // Verify that becky's account root is gone. BEAST_EXPECT(!env.closed()->exists(beckyAcctKey)); - // All it takes is a large enough XRP payment to resurrect + // All it takes is a large enough XAH payment to resurrect // becky's account. Try too small a payment. env(pay(alice, becky, drops(env.current()->fees().accountReserve(0)) - XRP(1)), - ter(tecNO_DST_INSUF_XRP)); + ter(tecNO_DST_INSUF_NATIVE)); env.close(); // Actually resurrect becky's account. diff --git a/src/test/app/PayStrand_test.cpp b/src/test/app/PayStrand_test.cpp index 4a67ff13f..db8f13466 100644 --- a/src/test/app/PayStrand_test.cpp +++ b/src/test/app/PayStrand_test.cpp @@ -1098,7 +1098,7 @@ struct PayStrand_test : public beast::unit_test::suite env(pay(alice, carol, XRP(100)), path(~USD, ~XRP), txflags(tfNoRippleDirect), - ter(temBAD_SEND_XRP_PATHS)); + ter(temBAD_SEND_NATIVE_PATHS)); } { @@ -1117,7 +1117,7 @@ struct PayStrand_test : public beast::unit_test::suite path(~USD, ~XRP), sendmax(XRP(200)), txflags(tfNoRippleDirect), - ter(temBAD_SEND_XRP_MAX)); + ter(temBAD_SEND_NATIVE_MAX)); } } diff --git a/src/test/app/TrustAndBalance_test.cpp b/src/test/app/TrustAndBalance_test.cpp index 0a94138ad..e0a9b087d 100644 --- a/src/test/app/TrustAndBalance_test.cpp +++ b/src/test/app/TrustAndBalance_test.cpp @@ -52,7 +52,7 @@ class TrustAndBalance_test : public beast::unit_test::suite using namespace test::jtx; Env env{*this, features}; - env(pay(env.master, "alice", XRP(1)), ter(tecNO_DST_INSUF_XRP)); + env(pay(env.master, "alice", XRP(1)), ter(tecNO_DST_INSUF_NATIVE)); env.close(); } diff --git a/src/test/rpc/AccountTx_test.cpp b/src/test/rpc/AccountTx_test.cpp index d59a63769..b4e34e6c9 100644 --- a/src/test/rpc/AccountTx_test.cpp +++ b/src/test/rpc/AccountTx_test.cpp @@ -723,12 +723,12 @@ class AccountTx_test : public beast::unit_test::suite } } - // All it takes is a large enough XRP payment to resurrect + // All it takes is a large enough XAH payment to resurrect // becky's account. Try too small a payment. env(pay(alice, becky, drops(env.current()->fees().accountReserve(0)) - XRP(1)), - ter(tecNO_DST_INSUF_XRP)); + ter(tecNO_DST_INSUF_NATIVE)); env.close(); // Actually resurrect becky's account. diff --git a/src/test/rpc/ServerDefinitions_test.cpp b/src/test/rpc/ServerDefinitions_test.cpp index b83c3ecf7..da0b5f9d4 100644 --- a/src/test/rpc/ServerDefinitions_test.cpp +++ b/src/test/rpc/ServerDefinitions_test.cpp @@ -193,7 +193,7 @@ public: "tecNO_ALTERNATIVE_KEY" : 130, "tecNO_AUTH" : 134, "tecNO_DST" : 124, - "tecNO_DST_INSUF_XRP" : 125, + "tecNO_DST_INSUF_NATIVE" : 125, "tecNO_ENTRY" : 140, "tecNO_ISSUER" : 133, "tecNO_LINE" : 135, @@ -285,11 +285,11 @@ public: "temBAD_PATH_LOOP" : -290, "temBAD_QUORUM" : -271, "temBAD_REGKEY" : -289, - "temBAD_SEND_XRP_LIMIT" : -288, - "temBAD_SEND_XRP_MAX" : -287, - "temBAD_SEND_XRP_NO_DIRECT" : -286, - "temBAD_SEND_XRP_PARTIAL" : -285, - "temBAD_SEND_XRP_PATHS" : -284, + "temBAD_SEND_NATIVE_LIMIT" : -288, + "temBAD_SEND_NATIVE_MAX" : -287, + "temBAD_SEND_NATIVE_NO_DIRECT" : -286, + "temBAD_SEND_NATIVE_PARTIAL" : -285, + "temBAD_SEND_NATIVE_PATHS" : -284, "temBAD_SEQUENCE" : -283, "temBAD_SIGNATURE" : -282, "temBAD_SIGNER" : -272,