Compare commits

..

7 Commits

Author SHA1 Message Date
Mayukha Vadari
a43de47f13 whoops 2026-03-18 18:25:09 -04:00
Mayukha Vadari
c78a68f218 Merge branch 'develop' into mvadari/payment-fixes 2026-03-18 17:56:51 -04:00
Mayukha Vadari
1dcbc503d8 add assertion to validate transfer fee does not exceed maximum allowed value 2026-03-18 17:50:04 -04:00
Mayukha Vadari
346fbbd3ac fix incorrect emplace result check logic 2026-03-18 17:44:20 -04:00
Mayukha Vadari
a2a66f68ad remove dead code 2026-03-18 17:41:14 -04:00
Mayukha Vadari
04c141cba5 fix reversed naming of variables 2026-03-18 17:35:58 -04:00
Mayukha Vadari
4cdc8561cd Refactor ledger open check in OfferCreate.cpp 2026-03-18 17:30:24 -04:00
9 changed files with 27 additions and 41 deletions

View File

@@ -11,7 +11,7 @@ runs:
steps:
# When a tag is pushed, the version is used as-is.
- name: Generate version for tag event
if: ${{ startsWith(github.ref, 'refs/tags/') }}
if: ${{ github.event_name == 'tag' }}
shell: bash
env:
VERSION: ${{ github.ref_name }}
@@ -22,7 +22,7 @@ runs:
# We use a plus sign instead of a hyphen because Conan recipe versions do
# not support two hyphens.
- name: Generate version for non-tag event
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
if: ${{ github.event_name != 'tag' }}
shell: bash
run: |
echo 'Extracting version from BuildInfo.cpp.'

View File

@@ -5,7 +5,7 @@ name: Tag
on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]*"
- "v*"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}

View File

@@ -89,10 +89,10 @@ jobs:
conan export . --version=rc
conan upload --confirm --check --remote="${REMOTE_NAME}" xrpl/rc
# When this workflow is triggered by a push event, it will always be when tagging a final
# When this workflow is triggered by a tag event, it will always be when tagging a final
# release, see on-tag.yml.
- name: Upload Conan recipe (release)
if: ${{ startsWith(github.ref, 'refs/tags/') }}
if: ${{ github.event_name == 'tag' }}
env:
REMOTE_NAME: ${{ inputs.remote_name }}
run: |

View File

@@ -58,8 +58,8 @@ private:
{
explicit Value() = default;
STAmount lowAcctCredits;
STAmount highAcctCredits;
STAmount lowAcctDebits;
STAmount highAcctDebits;
STAmount lowAcctOrigBalance;
};

View File

@@ -501,14 +501,6 @@ public:
{
return cur_.size();
}
void
removeIndex(std::size_t i)
{
if (i >= next_.size())
return;
next_.erase(next_.begin() + i);
}
};
/// @endcond
@@ -633,11 +625,6 @@ flow(
std::optional<BestStrand> best;
if (flowDebugInfo)
flowDebugInfo->newLiquidityPass();
// Index of strand to mark as inactive (remove from the active list) if
// the liquidity is used. This is used for strands that consume too many
// offers Constructed as `false,0` to workaround a gcc warning about
// uninitialized variables
std::optional<std::size_t> markInactiveOnUse;
for (size_t strandIndex = 0, sie = activeStrands.size(); strandIndex != sie; ++strandIndex)
{
Strand const* strand = activeStrands.get(strandIndex);
@@ -701,11 +688,6 @@ flow(
if (best)
{
if (markInactiveOnUse)
{
activeStrands.removeIndex(*markInactiveOnUse);
markInactiveOnUse.reset();
}
savedIns.insert(best->in);
savedOuts.insert(best->out);
remainingOut = outReq - sum(savedOuts);

View File

@@ -37,14 +37,14 @@ DeferredCredits::credit(
if (sender < receiver)
{
v.highAcctCredits = amount;
v.lowAcctCredits = amount.zeroed();
v.lowAcctDebits = amount;
v.highAcctDebits = amount.zeroed();
v.lowAcctOrigBalance = preCreditSenderBalance;
}
else
{
v.highAcctCredits = amount.zeroed();
v.lowAcctCredits = amount;
v.lowAcctDebits = amount.zeroed();
v.highAcctDebits = amount;
v.lowAcctOrigBalance = -preCreditSenderBalance;
}
@@ -56,11 +56,11 @@ DeferredCredits::credit(
auto& v = i->second;
if (sender < receiver)
{
v.highAcctCredits += amount;
v.lowAcctDebits += amount;
}
else
{
v.lowAcctCredits += amount;
v.highAcctDebits += amount;
}
}
}
@@ -104,11 +104,11 @@ DeferredCredits::adjustments(
if (main < other)
{
result.emplace(v.highAcctCredits, v.lowAcctCredits, v.lowAcctOrigBalance);
result.emplace(v.lowAcctDebits, v.highAcctDebits, v.lowAcctOrigBalance);
return result;
}
result.emplace(v.lowAcctCredits, v.highAcctCredits, -v.lowAcctOrigBalance);
result.emplace(v.highAcctDebits, v.lowAcctDebits, -v.lowAcctOrigBalance);
return result;
}
@@ -122,8 +122,8 @@ DeferredCredits::apply(DeferredCredits& to)
{
auto& toVal = r.first->second;
auto const& fromVal = i.second;
toVal.lowAcctCredits += fromVal.lowAcctCredits;
toVal.highAcctCredits += fromVal.highAcctCredits;
toVal.lowAcctDebits += fromVal.lowAcctDebits;
toVal.highAcctDebits += fromVal.highAcctDebits;
// Do not update the orig balance, it's already correct
}
}
@@ -349,14 +349,14 @@ PaymentSandbox::balanceChanges(ReadView const& view) const
auto const cur = newBalance.getCurrency();
result[std::make_tuple(lowID, highID, cur)] = delta;
auto r = result.emplace(std::make_tuple(lowID, lowID, cur), delta);
if (r.second)
if (!r.second)
{
r.first->second += delta;
}
delta.negate();
r = result.emplace(std::make_tuple(highID, highID, cur), delta);
if (r.second)
if (!r.second)
{
r.first->second += delta;
}

View File

@@ -800,7 +800,11 @@ transferRate(ReadView const& view, MPTID const& issuanceID)
// which represents 50% of 1,000,000,000
if (auto const sle = view.read(keylet::mptIssuance(issuanceID));
sle && sle->isFieldPresent(sfTransferFee))
return Rate{1'000'000'000u + 10'000 * sle->getFieldU16(sfTransferFee)};
{
auto const fee = sle->getFieldU16(sfTransferFee);
XRPL_ASSERT(fee <= maxTransferFee, "xrpl::transferRate : fee is too large");
return Rate{1'000'000'000u + 10'000 * fee};
}
return parityRate;
}

View File

@@ -562,7 +562,6 @@ OfferCreate::applyGuts(Sandbox& sb, Sandbox& sbCancel)
return {tecEXPIRED, true};
}
bool const bOpenLedger = sb.open();
bool crossed = false;
if (isTesSuccess(result))
@@ -648,7 +647,8 @@ OfferCreate::applyGuts(Sandbox& sb, Sandbox& sbCancel)
stream << " out: " << format_amount(place_offer.out);
}
if (result == tecFAILED_PROCESSING && bOpenLedger)
bool const isLedgerOpen = sb.open();
if (result == tecFAILED_PROCESSING && isLedgerOpen)
result = telFAILED_PROCESSING;
if (!isTesSuccess(result))

View File

@@ -89,7 +89,7 @@ TEST(parseStatmRSSkB, standard_format)
// Test empty string
{
std::string statm;
std::string statm = "";
long result = parseStatmRSSkB(statm);
EXPECT_EQ(result, -1);
}