mirror of
https://github.com/XRPLF/rippled.git
synced 2026-02-06 06:55:26 +00:00
Compare commits
7 Commits
copilot/ad
...
ximinez/as
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8b4404b8c6 | ||
|
|
bfc0acc734 | ||
|
|
9f7f43c16e | ||
|
|
8e98ba7564 | ||
|
|
d0b5ca9dab | ||
|
|
5e51893e9b | ||
|
|
3422c11d02 |
@@ -71,12 +71,6 @@ This release contains bug fixes only and no API changes.
|
||||
|
||||
This release contains bug fixes only and no API changes.
|
||||
|
||||
## Unreleased Changes
|
||||
|
||||
### Additions and bugfixes
|
||||
|
||||
- `submit`: Augmented response fields (`accepted`, `applied`, `broadcast`, `queued`, `kept`, `account_sequence_next`, `account_sequence_available`, `open_ledger_cost`, `validated_ledger_index`) are now included in sign-and-submit mode. Previously, these fields were only returned when submitting a binary transaction blob. ([#6304](https://github.com/XRPLF/rippled/pull/6304))
|
||||
|
||||
## XRP Ledger server version 2.5.0
|
||||
|
||||
[Version 2.5.0](https://github.com/XRPLF/rippled/releases/tag/2.5.0) was released on Jun 24, 2025.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"sqlite3/3.49.1#8631739a4c9b93bd3d6b753bac548a63%1765850149.926",
|
||||
"soci/4.0.3#a9f8d773cd33e356b5879a4b0564f287%1765850149.46",
|
||||
"snappy/1.1.10#968fef506ff261592ec30c574d4a7809%1765850147.878",
|
||||
"secp256k1/0.7.1#3a61e95e220062ef32c48d019e9c81f7%1770306721.686",
|
||||
"secp256k1/0.7.0#0fda78daa3b864deb8a2fbc083398356%1770226294.524",
|
||||
"rocksdb/10.5.1#4a197eca381a3e5ae8adf8cffa5aacd0%1765850186.86",
|
||||
"re2/20230301#ca3b241baec15bd31ea9187150e0b333%1765850148.103",
|
||||
"protobuf/6.32.1#f481fd276fc23a33b85a3ed1e898b693%1765850161.038",
|
||||
|
||||
@@ -32,7 +32,7 @@ class Xrpl(ConanFile):
|
||||
"libarchive/3.8.1",
|
||||
"nudb/2.0.9",
|
||||
"openssl/3.5.5",
|
||||
"secp256k1/0.7.1",
|
||||
"secp256k1/0.7.0",
|
||||
"soci/4.0.3",
|
||||
"zlib/1.3.1",
|
||||
]
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
// Add new amendments to the top of this list.
|
||||
// Keep it sorted in reverse chronological order.
|
||||
|
||||
XRPL_FIX (LendingProtocolV1_1, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (ExpiredNFTokenOfferRemoval, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (BatchInnerSigs, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(LendingProtocol, Supported::yes, VoteBehavior::DefaultNo)
|
||||
|
||||
@@ -883,6 +883,11 @@ STObject::add(Serializer& s, WhichFields whichFields) const
|
||||
XRPL_ASSERT(
|
||||
(sType != STI_OBJECT) || (field->getFName().fieldType == STI_OBJECT),
|
||||
"xrpl::STObject::add : valid field type");
|
||||
XRPL_ASSERT_PARTS(
|
||||
getStyle(field->getFName()) != soeDEFAULT || !field->isDefault(),
|
||||
"xrpl::STObject::add",
|
||||
"non-default value");
|
||||
|
||||
field->addFieldID(s);
|
||||
field->add(s);
|
||||
if (sType == STI_ARRAY || sType == STI_OBJECT)
|
||||
|
||||
@@ -592,18 +592,20 @@ class LendingHelpers_test : public beast::unit_test::suite
|
||||
auto const periodicRate = loanPeriodicRate(loanInterestRate, paymentInterval);
|
||||
Number const overpaymentAmount{50};
|
||||
|
||||
auto const overpaymentComponents = computeOverpaymentComponents(
|
||||
ExtendedPaymentComponents const overpaymentComponents = computeOverpaymentComponents(
|
||||
asset, loanScale, overpaymentAmount, TenthBips32(0), TenthBips32(0), managementFeeRate);
|
||||
|
||||
auto const loanProperties = computeLoanProperties(
|
||||
auto const loanProperites = computeLoanProperties(
|
||||
asset, loanPrincipal, loanInterestRate, paymentInterval, paymentsRemaining, managementFeeRate, loanScale);
|
||||
|
||||
Number const periodicPayment = loanProperites.periodicPayment;
|
||||
|
||||
auto const ret = tryOverpayment(
|
||||
asset,
|
||||
loanScale,
|
||||
overpaymentComponents,
|
||||
loanProperties.loanState,
|
||||
loanProperties.periodicPayment,
|
||||
loanProperites.loanState,
|
||||
periodicPayment,
|
||||
periodicRate,
|
||||
paymentsRemaining,
|
||||
managementFeeRate,
|
||||
@@ -634,20 +636,20 @@ class LendingHelpers_test : public beast::unit_test::suite
|
||||
|
||||
// =========== VALIDATE STATE CHANGES ===========
|
||||
BEAST_EXPECTS(
|
||||
loanProperties.loanState.interestDue - newState.interestDue == 0,
|
||||
loanProperites.loanState.interestDue - newState.interestDue == 0,
|
||||
" interest change mismatch: expected 0, got " +
|
||||
to_string(loanProperties.loanState.interestDue - newState.interestDue));
|
||||
to_string(loanProperites.loanState.interestDue - newState.interestDue));
|
||||
|
||||
BEAST_EXPECTS(
|
||||
loanProperties.loanState.managementFeeDue - newState.managementFeeDue == 0,
|
||||
loanProperites.loanState.managementFeeDue - newState.managementFeeDue == 0,
|
||||
" management fee change mismatch: expected 0, got " +
|
||||
to_string(loanProperties.loanState.managementFeeDue - newState.managementFeeDue));
|
||||
to_string(loanProperites.loanState.managementFeeDue - newState.managementFeeDue));
|
||||
|
||||
BEAST_EXPECTS(
|
||||
actualPaymentParts.principalPaid ==
|
||||
loanProperties.loanState.principalOutstanding - newState.principalOutstanding,
|
||||
loanProperites.loanState.principalOutstanding - newState.principalOutstanding,
|
||||
" principalPaid mismatch: expected " +
|
||||
to_string(loanProperties.loanState.principalOutstanding - newState.principalOutstanding) + ", got " +
|
||||
to_string(loanProperites.loanState.principalOutstanding - newState.principalOutstanding) + ", got " +
|
||||
to_string(actualPaymentParts.principalPaid));
|
||||
}
|
||||
|
||||
@@ -670,7 +672,7 @@ class LendingHelpers_test : public beast::unit_test::suite
|
||||
std::uint32_t const paymentsRemaining = 10;
|
||||
auto const periodicRate = loanPeriodicRate(loanInterestRate, paymentInterval);
|
||||
|
||||
auto const overpaymentComponents = computeOverpaymentComponents(
|
||||
ExtendedPaymentComponents const overpaymentComponents = computeOverpaymentComponents(
|
||||
asset,
|
||||
loanScale,
|
||||
Number{50, 0},
|
||||
@@ -678,15 +680,17 @@ class LendingHelpers_test : public beast::unit_test::suite
|
||||
TenthBips32(10'000), // 10% overpayment fee
|
||||
managementFeeRate);
|
||||
|
||||
auto const loanProperties = computeLoanProperties(
|
||||
auto const loanProperites = computeLoanProperties(
|
||||
asset, loanPrincipal, loanInterestRate, paymentInterval, paymentsRemaining, managementFeeRate, loanScale);
|
||||
|
||||
Number const periodicPayment = loanProperites.periodicPayment;
|
||||
|
||||
auto const ret = tryOverpayment(
|
||||
asset,
|
||||
loanScale,
|
||||
overpaymentComponents,
|
||||
loanProperties.loanState,
|
||||
loanProperties.periodicPayment,
|
||||
loanProperites.loanState,
|
||||
periodicPayment,
|
||||
periodicRate,
|
||||
paymentsRemaining,
|
||||
managementFeeRate,
|
||||
@@ -717,21 +721,21 @@ class LendingHelpers_test : public beast::unit_test::suite
|
||||
// =========== VALIDATE STATE CHANGES ===========
|
||||
// With no Loan interest, interest outstanding should not change
|
||||
BEAST_EXPECTS(
|
||||
loanProperties.loanState.interestDue - newState.interestDue == 0,
|
||||
loanProperites.loanState.interestDue - newState.interestDue == 0,
|
||||
" interest change mismatch: expected 0, got " +
|
||||
to_string(loanProperties.loanState.interestDue - newState.interestDue));
|
||||
to_string(loanProperites.loanState.interestDue - newState.interestDue));
|
||||
|
||||
// With no Loan management fee, management fee due should not change
|
||||
BEAST_EXPECTS(
|
||||
loanProperties.loanState.managementFeeDue - newState.managementFeeDue == 0,
|
||||
loanProperites.loanState.managementFeeDue - newState.managementFeeDue == 0,
|
||||
" management fee change mismatch: expected 0, got " +
|
||||
to_string(loanProperties.loanState.managementFeeDue - newState.managementFeeDue));
|
||||
to_string(loanProperites.loanState.managementFeeDue - newState.managementFeeDue));
|
||||
|
||||
BEAST_EXPECTS(
|
||||
actualPaymentParts.principalPaid ==
|
||||
loanProperties.loanState.principalOutstanding - newState.principalOutstanding,
|
||||
loanProperites.loanState.principalOutstanding - newState.principalOutstanding,
|
||||
" principalPaid mismatch: expected " +
|
||||
to_string(loanProperties.loanState.principalOutstanding - newState.principalOutstanding) + ", got " +
|
||||
to_string(loanProperites.loanState.principalOutstanding - newState.principalOutstanding) + ", got " +
|
||||
to_string(actualPaymentParts.principalPaid));
|
||||
}
|
||||
|
||||
@@ -754,7 +758,7 @@ class LendingHelpers_test : public beast::unit_test::suite
|
||||
std::uint32_t const paymentsRemaining = 10;
|
||||
auto const periodicRate = loanPeriodicRate(loanInterestRate, paymentInterval);
|
||||
|
||||
auto const overpaymentComponents = computeOverpaymentComponents(
|
||||
ExtendedPaymentComponents const overpaymentComponents = computeOverpaymentComponents(
|
||||
asset,
|
||||
loanScale,
|
||||
Number{50, 0},
|
||||
@@ -762,15 +766,17 @@ class LendingHelpers_test : public beast::unit_test::suite
|
||||
TenthBips32(0), // 0% overpayment fee
|
||||
managementFeeRate);
|
||||
|
||||
auto const loanProperties = computeLoanProperties(
|
||||
auto const loanProperites = computeLoanProperties(
|
||||
asset, loanPrincipal, loanInterestRate, paymentInterval, paymentsRemaining, managementFeeRate, loanScale);
|
||||
|
||||
Number const periodicPayment = loanProperites.periodicPayment;
|
||||
|
||||
auto const ret = tryOverpayment(
|
||||
asset,
|
||||
loanScale,
|
||||
overpaymentComponents,
|
||||
loanProperties.loanState,
|
||||
loanProperties.periodicPayment,
|
||||
loanProperites.loanState,
|
||||
periodicPayment,
|
||||
periodicRate,
|
||||
paymentsRemaining,
|
||||
managementFeeRate,
|
||||
@@ -806,22 +812,22 @@ class LendingHelpers_test : public beast::unit_test::suite
|
||||
// =========== VALIDATE STATE CHANGES ===========
|
||||
BEAST_EXPECTS(
|
||||
actualPaymentParts.principalPaid ==
|
||||
loanProperties.loanState.principalOutstanding - newState.principalOutstanding,
|
||||
loanProperites.loanState.principalOutstanding - newState.principalOutstanding,
|
||||
" principalPaid mismatch: expected " +
|
||||
to_string(loanProperties.loanState.principalOutstanding - newState.principalOutstanding) + ", got " +
|
||||
to_string(loanProperites.loanState.principalOutstanding - newState.principalOutstanding) + ", got " +
|
||||
to_string(actualPaymentParts.principalPaid));
|
||||
|
||||
BEAST_EXPECTS(
|
||||
actualPaymentParts.valueChange == newState.interestDue - loanProperties.loanState.interestDue,
|
||||
actualPaymentParts.valueChange == newState.interestDue - loanProperites.loanState.interestDue,
|
||||
" valueChange mismatch: expected " +
|
||||
to_string(newState.interestDue - loanProperties.loanState.interestDue) + ", got " +
|
||||
to_string(newState.interestDue - loanProperites.loanState.interestDue) + ", got " +
|
||||
to_string(actualPaymentParts.valueChange));
|
||||
|
||||
// With no Loan management fee, management fee due should not change
|
||||
BEAST_EXPECTS(
|
||||
loanProperties.loanState.managementFeeDue - newState.managementFeeDue == 0,
|
||||
loanProperites.loanState.managementFeeDue - newState.managementFeeDue == 0,
|
||||
" management fee change mismatch: expected 0, got " +
|
||||
to_string(loanProperties.loanState.managementFeeDue - newState.managementFeeDue));
|
||||
to_string(loanProperites.loanState.managementFeeDue - newState.managementFeeDue));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -843,7 +849,7 @@ class LendingHelpers_test : public beast::unit_test::suite
|
||||
std::uint32_t const paymentsRemaining = 10;
|
||||
auto const periodicRate = loanPeriodicRate(loanInterestRate, paymentInterval);
|
||||
|
||||
auto const overpaymentComponents = computeOverpaymentComponents(
|
||||
ExtendedPaymentComponents const overpaymentComponents = computeOverpaymentComponents(
|
||||
asset,
|
||||
loanScale,
|
||||
Number{50, 0},
|
||||
@@ -851,15 +857,17 @@ class LendingHelpers_test : public beast::unit_test::suite
|
||||
TenthBips32(0), // 0% overpayment fee
|
||||
managementFeeRate);
|
||||
|
||||
auto const loanProperties = computeLoanProperties(
|
||||
auto const loanProperites = computeLoanProperties(
|
||||
asset, loanPrincipal, loanInterestRate, paymentInterval, paymentsRemaining, managementFeeRate, loanScale);
|
||||
|
||||
Number const periodicPayment = loanProperites.periodicPayment;
|
||||
|
||||
auto const ret = tryOverpayment(
|
||||
asset,
|
||||
loanScale,
|
||||
overpaymentComponents,
|
||||
loanProperties.loanState,
|
||||
loanProperties.periodicPayment,
|
||||
loanProperites.loanState,
|
||||
periodicPayment,
|
||||
periodicRate,
|
||||
paymentsRemaining,
|
||||
managementFeeRate,
|
||||
@@ -896,26 +904,26 @@ class LendingHelpers_test : public beast::unit_test::suite
|
||||
// =========== VALIDATE STATE CHANGES ===========
|
||||
BEAST_EXPECTS(
|
||||
actualPaymentParts.principalPaid ==
|
||||
loanProperties.loanState.principalOutstanding - newState.principalOutstanding,
|
||||
loanProperites.loanState.principalOutstanding - newState.principalOutstanding,
|
||||
" principalPaid mismatch: expected " +
|
||||
to_string(loanProperties.loanState.principalOutstanding - newState.principalOutstanding) + ", got " +
|
||||
to_string(loanProperites.loanState.principalOutstanding - newState.principalOutstanding) + ", got " +
|
||||
to_string(actualPaymentParts.principalPaid));
|
||||
|
||||
// The change in interest is equal to the value change sans the
|
||||
// overpayment interest
|
||||
BEAST_EXPECTS(
|
||||
actualPaymentParts.valueChange - actualPaymentParts.interestPaid ==
|
||||
newState.interestDue - loanProperties.loanState.interestDue,
|
||||
newState.interestDue - loanProperites.loanState.interestDue,
|
||||
" valueChange mismatch: expected " +
|
||||
to_string(
|
||||
newState.interestDue - loanProperties.loanState.interestDue + actualPaymentParts.interestPaid) +
|
||||
newState.interestDue - loanProperites.loanState.interestDue + actualPaymentParts.interestPaid) +
|
||||
", got " + to_string(actualPaymentParts.valueChange));
|
||||
|
||||
// With no Loan management fee, management fee due should not change
|
||||
BEAST_EXPECTS(
|
||||
loanProperties.loanState.managementFeeDue - newState.managementFeeDue == 0,
|
||||
loanProperites.loanState.managementFeeDue - newState.managementFeeDue == 0,
|
||||
" management fee change mismatch: expected 0, got " +
|
||||
to_string(loanProperties.loanState.managementFeeDue - newState.managementFeeDue));
|
||||
to_string(loanProperites.loanState.managementFeeDue - newState.managementFeeDue));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -939,7 +947,7 @@ class LendingHelpers_test : public beast::unit_test::suite
|
||||
std::uint32_t const paymentsRemaining = 10;
|
||||
auto const periodicRate = loanPeriodicRate(loanInterestRate, paymentInterval);
|
||||
|
||||
auto const overpaymentComponents = computeOverpaymentComponents(
|
||||
ExtendedPaymentComponents const overpaymentComponents = computeOverpaymentComponents(
|
||||
asset,
|
||||
loanScale,
|
||||
Number{50, 0},
|
||||
@@ -947,15 +955,17 @@ class LendingHelpers_test : public beast::unit_test::suite
|
||||
TenthBips32(0), // 0% overpayment fee
|
||||
managementFeeRate);
|
||||
|
||||
auto const loanProperties = computeLoanProperties(
|
||||
auto const loanProperites = computeLoanProperties(
|
||||
asset, loanPrincipal, loanInterestRate, paymentInterval, paymentsRemaining, managementFeeRate, loanScale);
|
||||
|
||||
Number const periodicPayment = loanProperites.periodicPayment;
|
||||
|
||||
auto const ret = tryOverpayment(
|
||||
asset,
|
||||
loanScale,
|
||||
overpaymentComponents,
|
||||
loanProperties.loanState,
|
||||
loanProperties.periodicPayment,
|
||||
loanProperites.loanState,
|
||||
periodicPayment,
|
||||
periodicRate,
|
||||
paymentsRemaining,
|
||||
managementFeeRate,
|
||||
@@ -994,23 +1004,23 @@ class LendingHelpers_test : public beast::unit_test::suite
|
||||
// =========== VALIDATE STATE CHANGES ===========
|
||||
BEAST_EXPECTS(
|
||||
actualPaymentParts.principalPaid ==
|
||||
loanProperties.loanState.principalOutstanding - newState.principalOutstanding,
|
||||
loanProperites.loanState.principalOutstanding - newState.principalOutstanding,
|
||||
" principalPaid mismatch: expected " +
|
||||
to_string(loanProperties.loanState.principalOutstanding - newState.principalOutstanding) + ", got " +
|
||||
to_string(loanProperites.loanState.principalOutstanding - newState.principalOutstanding) + ", got " +
|
||||
to_string(actualPaymentParts.principalPaid));
|
||||
|
||||
// Note that the management fee value change is not captured, as this
|
||||
// value is not needed to correctly update the Vault state.
|
||||
BEAST_EXPECTS(
|
||||
(newState.managementFeeDue - loanProperties.loanState.managementFeeDue == Number{-20592, -5}),
|
||||
(newState.managementFeeDue - loanProperites.loanState.managementFeeDue == Number{-20592, -5}),
|
||||
" management fee change mismatch: expected " + to_string(Number{-20592, -5}) + ", got " +
|
||||
to_string(newState.managementFeeDue - loanProperties.loanState.managementFeeDue));
|
||||
to_string(newState.managementFeeDue - loanProperites.loanState.managementFeeDue));
|
||||
|
||||
BEAST_EXPECTS(
|
||||
actualPaymentParts.valueChange - actualPaymentParts.interestPaid ==
|
||||
newState.interestDue - loanProperties.loanState.interestDue,
|
||||
newState.interestDue - loanProperites.loanState.interestDue,
|
||||
" valueChange mismatch: expected " +
|
||||
to_string(newState.interestDue - loanProperties.loanState.interestDue) + ", got " +
|
||||
to_string(newState.interestDue - loanProperites.loanState.interestDue) + ", got " +
|
||||
to_string(actualPaymentParts.valueChange - actualPaymentParts.interestPaid));
|
||||
}
|
||||
|
||||
@@ -1033,7 +1043,7 @@ class LendingHelpers_test : public beast::unit_test::suite
|
||||
std::uint32_t const paymentsRemaining = 10;
|
||||
auto const periodicRate = loanPeriodicRate(loanInterestRate, paymentInterval);
|
||||
|
||||
auto const overpaymentComponents = computeOverpaymentComponents(
|
||||
ExtendedPaymentComponents const overpaymentComponents = computeOverpaymentComponents(
|
||||
asset,
|
||||
loanScale,
|
||||
Number{50, 0},
|
||||
@@ -1041,15 +1051,17 @@ class LendingHelpers_test : public beast::unit_test::suite
|
||||
TenthBips32(10'000), // 10% overpayment fee
|
||||
managementFeeRate);
|
||||
|
||||
auto const loanProperties = computeLoanProperties(
|
||||
auto const loanProperites = computeLoanProperties(
|
||||
asset, loanPrincipal, loanInterestRate, paymentInterval, paymentsRemaining, managementFeeRate, loanScale);
|
||||
|
||||
Number const periodicPayment = loanProperites.periodicPayment;
|
||||
|
||||
auto const ret = tryOverpayment(
|
||||
asset,
|
||||
loanScale,
|
||||
overpaymentComponents,
|
||||
loanProperties.loanState,
|
||||
loanProperties.periodicPayment,
|
||||
loanProperites.loanState,
|
||||
periodicPayment,
|
||||
periodicRate,
|
||||
paymentsRemaining,
|
||||
managementFeeRate,
|
||||
@@ -1089,23 +1101,23 @@ class LendingHelpers_test : public beast::unit_test::suite
|
||||
|
||||
BEAST_EXPECTS(
|
||||
actualPaymentParts.principalPaid ==
|
||||
loanProperties.loanState.principalOutstanding - newState.principalOutstanding,
|
||||
loanProperites.loanState.principalOutstanding - newState.principalOutstanding,
|
||||
" principalPaid mismatch: expected " +
|
||||
to_string(loanProperties.loanState.principalOutstanding - newState.principalOutstanding) + ", got " +
|
||||
to_string(loanProperites.loanState.principalOutstanding - newState.principalOutstanding) + ", got " +
|
||||
to_string(actualPaymentParts.principalPaid));
|
||||
|
||||
// Note that the management fee value change is not captured, as this
|
||||
// value is not needed to correctly update the Vault state.
|
||||
BEAST_EXPECTS(
|
||||
(newState.managementFeeDue - loanProperties.loanState.managementFeeDue == Number{-18304, -5}),
|
||||
(newState.managementFeeDue - loanProperites.loanState.managementFeeDue == Number{-18304, -5}),
|
||||
" management fee change mismatch: expected " + to_string(Number{-18304, -5}) + ", got " +
|
||||
to_string(newState.managementFeeDue - loanProperties.loanState.managementFeeDue));
|
||||
to_string(newState.managementFeeDue - loanProperites.loanState.managementFeeDue));
|
||||
|
||||
BEAST_EXPECTS(
|
||||
actualPaymentParts.valueChange - actualPaymentParts.interestPaid ==
|
||||
newState.interestDue - loanProperties.loanState.interestDue,
|
||||
newState.interestDue - loanProperites.loanState.interestDue,
|
||||
" valueChange mismatch: expected " +
|
||||
to_string(newState.interestDue - loanProperties.loanState.interestDue) + ", got " +
|
||||
to_string(newState.interestDue - loanProperites.loanState.interestDue) + ", got " +
|
||||
to_string(actualPaymentParts.valueChange - actualPaymentParts.interestPaid));
|
||||
}
|
||||
|
||||
|
||||
@@ -1701,10 +1701,21 @@ class LoanBroker_test : public beast::unit_test::suite
|
||||
testRIPD4274MPT();
|
||||
}
|
||||
|
||||
void
|
||||
testFixAmendmentEnabled()
|
||||
{
|
||||
using namespace jtx;
|
||||
testcase("testFixAmendmentEnabled");
|
||||
Env env{*this};
|
||||
|
||||
BEAST_EXPECT(env.enabled(fixLendingProtocolV1_1));
|
||||
}
|
||||
|
||||
public:
|
||||
void
|
||||
run() override
|
||||
{
|
||||
testFixAmendmentEnabled();
|
||||
testLoanBrokerSetDebtMaximum();
|
||||
testLoanBrokerCoverDepositNullVault();
|
||||
|
||||
|
||||
@@ -827,13 +827,8 @@ public:
|
||||
|
||||
// applyManifest should accept new manifests with
|
||||
// higher sequence numbers
|
||||
auto const seq0 = cache.sequence();
|
||||
BEAST_EXPECT(cache.applyManifest(clone(s_a0)) == ManifestDisposition::accepted);
|
||||
BEAST_EXPECT(cache.sequence() > seq0);
|
||||
|
||||
auto const seq1 = cache.sequence();
|
||||
BEAST_EXPECT(cache.applyManifest(clone(s_a0)) == ManifestDisposition::stale);
|
||||
BEAST_EXPECT(cache.sequence() == seq1);
|
||||
|
||||
BEAST_EXPECT(cache.applyManifest(clone(s_a1)) == ManifestDisposition::accepted);
|
||||
BEAST_EXPECT(cache.applyManifest(clone(s_a1)) == ManifestDisposition::stale);
|
||||
|
||||
@@ -1,96 +0,0 @@
|
||||
#include <test/jtx.h>
|
||||
|
||||
#include <xrpld/core/ConfigSections.h>
|
||||
|
||||
#include <xrpl/protocol/jss.h>
|
||||
|
||||
namespace xrpl {
|
||||
|
||||
class Submit_test : public beast::unit_test::suite
|
||||
{
|
||||
public:
|
||||
void
|
||||
testAugmentedFields()
|
||||
{
|
||||
testcase("Augmented fields in sign-and-submit mode");
|
||||
|
||||
using namespace test::jtx;
|
||||
|
||||
// Enable signing support in config
|
||||
Env env{*this, envconfig([](std::unique_ptr<Config> cfg) {
|
||||
cfg->loadFromString("[" SECTION_SIGNING_SUPPORT "]\ntrue");
|
||||
return cfg;
|
||||
})};
|
||||
|
||||
Account const alice{"alice"};
|
||||
Account const bob{"bob"};
|
||||
|
||||
env.fund(XRP(10000), alice, bob);
|
||||
env.close();
|
||||
|
||||
// Test 1: Sign-and-submit mode should return augmented fields
|
||||
{
|
||||
Json::Value jv;
|
||||
jv[jss::tx_json][jss::TransactionType] = jss::Payment;
|
||||
jv[jss::tx_json][jss::Account] = alice.human();
|
||||
jv[jss::tx_json][jss::Destination] = bob.human();
|
||||
jv[jss::tx_json][jss::Amount] = XRP(100).value().getJson(JsonOptions::none);
|
||||
jv[jss::secret] = alice.name();
|
||||
|
||||
auto const result = env.rpc("json", "submit", to_string(jv))[jss::result];
|
||||
|
||||
// These are the augmented fields that should be present
|
||||
BEAST_EXPECT(result.isMember(jss::engine_result));
|
||||
BEAST_EXPECT(result.isMember(jss::engine_result_code));
|
||||
BEAST_EXPECT(result.isMember(jss::engine_result_message));
|
||||
|
||||
// New augmented fields from issue #3125
|
||||
BEAST_EXPECT(result.isMember(jss::accepted));
|
||||
BEAST_EXPECT(result.isMember(jss::applied));
|
||||
BEAST_EXPECT(result.isMember(jss::broadcast));
|
||||
BEAST_EXPECT(result.isMember(jss::queued));
|
||||
BEAST_EXPECT(result.isMember(jss::kept));
|
||||
|
||||
// Current ledger state fields
|
||||
BEAST_EXPECT(result.isMember(jss::account_sequence_next));
|
||||
BEAST_EXPECT(result.isMember(jss::account_sequence_available));
|
||||
BEAST_EXPECT(result.isMember(jss::open_ledger_cost));
|
||||
BEAST_EXPECT(result.isMember(jss::validated_ledger_index));
|
||||
|
||||
// Verify basic transaction fields
|
||||
BEAST_EXPECT(result.isMember(jss::tx_blob));
|
||||
BEAST_EXPECT(result.isMember(jss::tx_json));
|
||||
}
|
||||
|
||||
// Test 2: Binary blob mode should also return augmented fields (regression test)
|
||||
{
|
||||
auto jt = env.jt(pay(alice, bob, XRP(100)));
|
||||
Serializer s;
|
||||
jt.stx->add(s);
|
||||
|
||||
auto const result = env.rpc("submit", strHex(s.slice()))[jss::result];
|
||||
|
||||
// Verify augmented fields are present in binary mode too
|
||||
BEAST_EXPECT(result.isMember(jss::engine_result));
|
||||
BEAST_EXPECT(result.isMember(jss::accepted));
|
||||
BEAST_EXPECT(result.isMember(jss::applied));
|
||||
BEAST_EXPECT(result.isMember(jss::broadcast));
|
||||
BEAST_EXPECT(result.isMember(jss::queued));
|
||||
BEAST_EXPECT(result.isMember(jss::kept));
|
||||
BEAST_EXPECT(result.isMember(jss::account_sequence_next));
|
||||
BEAST_EXPECT(result.isMember(jss::account_sequence_available));
|
||||
BEAST_EXPECT(result.isMember(jss::open_ledger_cost));
|
||||
BEAST_EXPECT(result.isMember(jss::validated_ledger_index));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
run() override
|
||||
{
|
||||
testAugmentedFields();
|
||||
}
|
||||
};
|
||||
|
||||
BEAST_DEFINE_TESTSUITE(Submit, rpc, xrpl);
|
||||
|
||||
} // namespace xrpl
|
||||
@@ -459,10 +459,6 @@ ManifestCache::applyManifest(Manifest m)
|
||||
|
||||
auto masterKey = m.masterKey;
|
||||
map_.emplace(std::move(masterKey), std::move(m));
|
||||
|
||||
// Something has changed. Keep track of it.
|
||||
seq_++;
|
||||
|
||||
return ManifestDisposition::accepted;
|
||||
}
|
||||
|
||||
|
||||
@@ -699,8 +699,6 @@ transactionFormatResultImpl(Transaction::pointer tpTrans, unsigned apiVersion)
|
||||
jvResult[jss::engine_result] = sToken;
|
||||
jvResult[jss::engine_result_code] = tpTrans->getResult();
|
||||
jvResult[jss::engine_result_message] = sHuman;
|
||||
|
||||
RPC::populateAugmentedSubmitFields(jvResult, tpTrans);
|
||||
}
|
||||
}
|
||||
catch (std::exception&)
|
||||
@@ -714,28 +712,6 @@ transactionFormatResultImpl(Transaction::pointer tpTrans, unsigned apiVersion)
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
void
|
||||
populateAugmentedSubmitFields(Json::Value& jvResult, std::shared_ptr<Transaction> const& transaction)
|
||||
{
|
||||
auto const submitResult = transaction->getSubmitResult();
|
||||
|
||||
jvResult[jss::accepted] = submitResult.any();
|
||||
jvResult[jss::applied] = submitResult.applied;
|
||||
jvResult[jss::broadcast] = submitResult.broadcast;
|
||||
jvResult[jss::queued] = submitResult.queued;
|
||||
jvResult[jss::kept] = submitResult.kept;
|
||||
|
||||
if (auto currentLedgerState = transaction->getCurrentLedgerState())
|
||||
{
|
||||
jvResult[jss::account_sequence_next] = safe_cast<Json::Value::UInt>(currentLedgerState->accountSeqNext);
|
||||
jvResult[jss::account_sequence_available] = safe_cast<Json::Value::UInt>(currentLedgerState->accountSeqAvail);
|
||||
jvResult[jss::open_ledger_cost] = to_string(currentLedgerState->minFeeRequired);
|
||||
jvResult[jss::validated_ledger_index] = safe_cast<Json::Value::UInt>(currentLedgerState->validatedLedger);
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
[[nodiscard]] static XRPAmount
|
||||
getTxFee(Application const& app, Config const& config, Json::Value tx)
|
||||
{
|
||||
|
||||
@@ -15,18 +15,6 @@ class TxQ;
|
||||
|
||||
namespace RPC {
|
||||
|
||||
/** Populate augmented submit fields into a JSON result.
|
||||
This helper populates the submit result flags (accepted, applied,
|
||||
broadcast, queued, kept) and current ledger state fields
|
||||
(account_sequence_next, account_sequence_available, open_ledger_cost,
|
||||
validated_ledger_index) from a Transaction pointer.
|
||||
|
||||
@param jvResult The JSON result to populate
|
||||
@param transaction The transaction containing the submit result and state
|
||||
*/
|
||||
void
|
||||
populateAugmentedSubmitFields(Json::Value& jvResult, std::shared_ptr<Transaction> const& transaction);
|
||||
|
||||
Json::Value
|
||||
getCurrentNetworkFee(
|
||||
Role const role,
|
||||
|
||||
@@ -127,7 +127,23 @@ doSubmit(RPC::JsonContext& context)
|
||||
jvResult[jss::engine_result_code] = transaction->getResult();
|
||||
jvResult[jss::engine_result_message] = sHuman;
|
||||
|
||||
RPC::populateAugmentedSubmitFields(jvResult, transaction);
|
||||
auto const submitResult = transaction->getSubmitResult();
|
||||
|
||||
jvResult[jss::accepted] = submitResult.any();
|
||||
jvResult[jss::applied] = submitResult.applied;
|
||||
jvResult[jss::broadcast] = submitResult.broadcast;
|
||||
jvResult[jss::queued] = submitResult.queued;
|
||||
jvResult[jss::kept] = submitResult.kept;
|
||||
|
||||
if (auto currentLedgerState = transaction->getCurrentLedgerState())
|
||||
{
|
||||
jvResult[jss::account_sequence_next] = safe_cast<Json::Value::UInt>(currentLedgerState->accountSeqNext);
|
||||
jvResult[jss::account_sequence_available] =
|
||||
safe_cast<Json::Value::UInt>(currentLedgerState->accountSeqAvail);
|
||||
jvResult[jss::open_ledger_cost] = to_string(currentLedgerState->minFeeRequired);
|
||||
jvResult[jss::validated_ledger_index] =
|
||||
safe_cast<Json::Value::UInt>(currentLedgerState->validatedLedger);
|
||||
}
|
||||
}
|
||||
|
||||
return jvResult;
|
||||
|
||||
Reference in New Issue
Block a user