Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AMMBid: use tecINTERNAL for 'impossible' errors #4674

Merged
merged 4 commits into from
Sep 1, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions src/ripple/app/tx/impl/AMMBid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,11 @@ applyBid(
lptAMMBalance, toSTAmount(lptAMMBalance.issue(), burn), false);
if (saBurn >= lptAMMBalance)
{
JLOG(ctx_.journal.debug())
<< "AMM Bid: invalid burn " << burn << " " << lptAMMBalance;
return tecAMM_BALANCE;
// This error case should never occur.
JLOG(ctx_.journal.warn())
<< "AMM Bid: LP Token burn exceeds AMM balance " << burn << " "
<< lptAMMBalance;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So far as I can tell, every tecINTERNAL result that logs, logs as error() or higher, other than a few in AMM code, which is new, and which I'd also consider an oversight.

These two log messages should be changed to error(), and I wouldn't mind seeing those others changed to error(), too.

return tecINTERNAL;
}
auto res =
redeemIOU(sb, account_, saBurn, lpTokens.issue(), ctx_.journal);
Expand Down Expand Up @@ -316,9 +318,10 @@ applyBid(
auto const refund = fractionRemaining * pricePurchased;
if (refund > *payPrice)
{
JLOG(ctx_.journal.debug())
<< "AMM Bid: invalid refund " << refund << " " << *payPrice;
return {tecINSUFFICIENT_PAYMENT, false};
// This error case should never occur.
JLOG(ctx_.journal.warn()) << "AMM Bid: refund exceeds payPrice "
<< refund << " " << *payPrice;
return {tecINTERNAL, false};
}
res = accountSend(
sb,
Expand Down