mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-08 13:15:50 +00:00
Compare commits
4 Commits
legleux/fi
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c39f9c561c | ||
|
|
173f9f7bb0 | ||
|
|
28a1f90938 | ||
|
|
673fb06c75 |
9
.github/scripts/rename/cmake.sh
vendored
9
.github/scripts/rename/cmake.sh
vendored
@@ -74,12 +74,19 @@ if grep -q '"xrpld"' cmake/XrplCore.cmake; then
|
||||
# The script has been rerun, so just restore the name of the binary.
|
||||
${SED_COMMAND} -i 's/"xrpld"/"rippled"/' cmake/XrplCore.cmake
|
||||
elif ! grep -q '"rippled"' cmake/XrplCore.cmake; then
|
||||
ghead -n -1 cmake/XrplCore.cmake > cmake.tmp
|
||||
${HEAD_COMMAND} -n -1 cmake/XrplCore.cmake > cmake.tmp
|
||||
echo ' # For the time being, we will keep the name of the binary as it was.' >> cmake.tmp
|
||||
echo ' set_target_properties(xrpld PROPERTIES OUTPUT_NAME "rippled")' >> cmake.tmp
|
||||
tail -1 cmake/XrplCore.cmake >> cmake.tmp
|
||||
mv cmake.tmp cmake/XrplCore.cmake
|
||||
fi
|
||||
|
||||
# Restore the symlink from 'xrpld' to 'rippled'.
|
||||
${SED_COMMAND} -i -E 's@create_symbolic_link\(xrpld@create_symbolic_link(rippled@' cmake/XrplInstall.cmake
|
||||
|
||||
# Remove the symlink that previously pointed from 'ripple' to 'xrpl' but now is
|
||||
# no longer needed.
|
||||
${SED_COMMAND} -z -i -E 's@install\(CODE.+CMAKE_INSTALL_INCLUDEDIR}/xrpl\)\n"\)\n+@@' cmake/XrplInstall.cmake
|
||||
|
||||
popd
|
||||
echo "Renaming complete."
|
||||
|
||||
@@ -37,13 +37,6 @@ install(
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
|
||||
)
|
||||
|
||||
install(CODE "
|
||||
set(CMAKE_MODULE_PATH \"${CMAKE_MODULE_PATH}\")
|
||||
include(create_symbolic_link)
|
||||
create_symbolic_link(xrpl \
|
||||
\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/xrpl)
|
||||
")
|
||||
|
||||
install (EXPORT XrplExports
|
||||
FILE XrplTargets.cmake
|
||||
NAMESPACE Xrpl::
|
||||
@@ -74,7 +67,7 @@ if (is_root_project AND TARGET xrpld)
|
||||
install(CODE "
|
||||
set(CMAKE_MODULE_PATH \"${CMAKE_MODULE_PATH}\")
|
||||
include(create_symbolic_link)
|
||||
create_symbolic_link(xrpld${suffix} \
|
||||
create_symbolic_link(rippled${suffix} \
|
||||
\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/xrpld${suffix})
|
||||
")
|
||||
endif ()
|
||||
|
||||
@@ -62,7 +62,6 @@ XRPL_FIX (UniversalNumber, Supported::yes, VoteBehavior::DefaultNo
|
||||
XRPL_FEATURE(XRPFees, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(DisallowIncoming, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (RemoveNFTokenAutoTrustLine, Supported::yes, VoteBehavior::DefaultYes)
|
||||
XRPL_FIX (TrustLinesToSelf, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(ExpandedSignerList, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(CheckCashMakesTrustLine, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(FlowSortStrands, Supported::yes, VoteBehavior::DefaultYes)
|
||||
@@ -119,6 +118,7 @@ XRPL_RETIRE(fixReducedOffersV1)
|
||||
XRPL_RETIRE(fixRmSmallIncreasedQOffers)
|
||||
XRPL_RETIRE(fixSTAmountCanonicalize)
|
||||
XRPL_RETIRE(fixTakerDryOfferRemoval)
|
||||
XRPL_RETIRE(fixTrustLinesToSelf)
|
||||
XRPL_RETIRE(CryptoConditions)
|
||||
XRPL_RETIRE(Escrow)
|
||||
XRPL_RETIRE(EnforceInvariants)
|
||||
|
||||
@@ -121,7 +121,8 @@ class Feature_test : public beast::unit_test::suite
|
||||
// Test a random sampling of the variables. If any of these get retired
|
||||
// or removed, swap out for any other feature.
|
||||
BEAST_EXPECT(
|
||||
featureToName(fixTrustLinesToSelf) == "fixTrustLinesToSelf");
|
||||
featureToName(fixRemoveNFTokenAutoTrustLine) ==
|
||||
"fixRemoveNFTokenAutoTrustLine");
|
||||
BEAST_EXPECT(featureToName(featureFlow) == "Flow");
|
||||
BEAST_EXPECT(featureToName(featureNegativeUNL) == "NegativeUNL");
|
||||
BEAST_EXPECT(
|
||||
|
||||
@@ -106,7 +106,7 @@ OrderBookDB::update(std::shared_ptr<ReadView const> const& ledger)
|
||||
book.domain = (*sle)[~sfDomainID];
|
||||
|
||||
if (book.domain)
|
||||
domainBooks_[{book.in, *book.domain}].insert(book.out);
|
||||
domainBooks[{book.in, *book.domain}].insert(book.out);
|
||||
else
|
||||
allBooks[book.in].insert(book.out);
|
||||
|
||||
|
||||
@@ -147,88 +147,6 @@ Change::preCompute()
|
||||
account_ == beast::zero, "ripple::Change::preCompute : zero account");
|
||||
}
|
||||
|
||||
void
|
||||
Change::activateTrustLinesToSelfFix()
|
||||
{
|
||||
JLOG(j_.warn()) << "fixTrustLinesToSelf amendment activation code starting";
|
||||
|
||||
auto removeTrustLineToSelf = [this](Sandbox& sb, uint256 id) {
|
||||
auto tl = sb.peek(keylet::child(id));
|
||||
|
||||
if (tl == nullptr)
|
||||
{
|
||||
JLOG(j_.warn()) << id << ": Unable to locate trustline";
|
||||
return true;
|
||||
}
|
||||
|
||||
if (tl->getType() != ltRIPPLE_STATE)
|
||||
{
|
||||
JLOG(j_.warn()) << id << ": Unexpected type "
|
||||
<< static_cast<std::uint16_t>(tl->getType());
|
||||
return true;
|
||||
}
|
||||
|
||||
auto const& lo = tl->getFieldAmount(sfLowLimit);
|
||||
auto const& hi = tl->getFieldAmount(sfHighLimit);
|
||||
|
||||
if (lo != hi)
|
||||
{
|
||||
JLOG(j_.warn()) << id << ": Trustline doesn't meet requirements";
|
||||
return true;
|
||||
}
|
||||
|
||||
if (auto const page = tl->getFieldU64(sfLowNode); !sb.dirRemove(
|
||||
keylet::ownerDir(lo.getIssuer()), page, tl->key(), false))
|
||||
{
|
||||
JLOG(j_.error()) << id << ": failed to remove low entry from "
|
||||
<< toBase58(lo.getIssuer()) << ":" << page
|
||||
<< " owner directory";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (auto const page = tl->getFieldU64(sfHighNode); !sb.dirRemove(
|
||||
keylet::ownerDir(hi.getIssuer()), page, tl->key(), false))
|
||||
{
|
||||
JLOG(j_.error()) << id << ": failed to remove high entry from "
|
||||
<< toBase58(hi.getIssuer()) << ":" << page
|
||||
<< " owner directory";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (tl->getFlags() & lsfLowReserve)
|
||||
adjustOwnerCount(
|
||||
sb, sb.peek(keylet::account(lo.getIssuer())), -1, j_);
|
||||
|
||||
if (tl->getFlags() & lsfHighReserve)
|
||||
adjustOwnerCount(
|
||||
sb, sb.peek(keylet::account(hi.getIssuer())), -1, j_);
|
||||
|
||||
sb.erase(tl);
|
||||
|
||||
JLOG(j_.warn()) << "Successfully deleted trustline " << id;
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
using namespace std::literals;
|
||||
|
||||
Sandbox sb(&view());
|
||||
|
||||
if (removeTrustLineToSelf(
|
||||
sb,
|
||||
uint256{
|
||||
"2F8F21EFCAFD7ACFB07D5BB04F0D2E18587820C7611305BB674A64EAB0FA71E1"sv}) &&
|
||||
removeTrustLineToSelf(
|
||||
sb,
|
||||
uint256{
|
||||
"326035D5C0560A9DA8636545DD5A1B0DFCFF63E68D491B5522B767BB00564B1A"sv}))
|
||||
{
|
||||
JLOG(j_.warn()) << "fixTrustLinesToSelf amendment activation code "
|
||||
"executed successfully";
|
||||
sb.apply(ctx_.rawView());
|
||||
}
|
||||
}
|
||||
|
||||
TER
|
||||
Change::applyAmendment()
|
||||
{
|
||||
@@ -305,9 +223,6 @@ Change::applyAmendment()
|
||||
amendments.push_back(amendment);
|
||||
amendmentObject->setFieldV256(sfAmendments, amendments);
|
||||
|
||||
if (amendment == fixTrustLinesToSelf)
|
||||
activateTrustLinesToSelfFix();
|
||||
|
||||
ctx_.app.getAmendmentTable().enable(amendment);
|
||||
|
||||
if (!ctx_.app.getAmendmentTable().isSupported(amendment))
|
||||
|
||||
@@ -29,9 +29,6 @@ public:
|
||||
preclaim(PreclaimContext const& ctx);
|
||||
|
||||
private:
|
||||
void
|
||||
activateTrustLinesToSelfFix();
|
||||
|
||||
TER
|
||||
applyAmendment();
|
||||
|
||||
|
||||
@@ -195,29 +195,8 @@ SetTrust::preclaim(PreclaimContext const& ctx)
|
||||
auto const currency = saLimitAmount.getCurrency();
|
||||
auto const uDstAccountID = saLimitAmount.getIssuer();
|
||||
|
||||
if (ctx.view.rules().enabled(fixTrustLinesToSelf))
|
||||
{
|
||||
if (id == uDstAccountID)
|
||||
return temDST_IS_SRC;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (id == uDstAccountID)
|
||||
{
|
||||
// Prevent trustline to self from being created,
|
||||
// unless one has somehow already been created
|
||||
// (in which case doApply will clean it up).
|
||||
auto const sleDelete =
|
||||
ctx.view.read(keylet::line(id, uDstAccountID, currency));
|
||||
|
||||
if (!sleDelete)
|
||||
{
|
||||
JLOG(ctx.j.trace())
|
||||
<< "Malformed transaction: Can not extend credit to self.";
|
||||
return temDST_IS_SRC;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (id == uDstAccountID)
|
||||
return temDST_IS_SRC;
|
||||
|
||||
// This might be nullptr
|
||||
auto const sleDst = ctx.view.read(keylet::account(uDstAccountID));
|
||||
@@ -403,21 +382,6 @@ SetTrust::doApply()
|
||||
|
||||
auto viewJ = ctx_.app.journal("View");
|
||||
|
||||
// Trust lines to self are impossible but because of the old bug there
|
||||
// are two on 19-02-2022. This code was here to allow those trust lines
|
||||
// to be deleted. The fixTrustLinesToSelf fix amendment will remove them
|
||||
// when it enables so this code will no longer be needed.
|
||||
if (!view().rules().enabled(fixTrustLinesToSelf) &&
|
||||
account_ == uDstAccountID)
|
||||
{
|
||||
return trustDelete(
|
||||
view(),
|
||||
view().peek(keylet::line(account_, uDstAccountID, currency)),
|
||||
account_,
|
||||
uDstAccountID,
|
||||
viewJ);
|
||||
}
|
||||
|
||||
SLE::pointer sleDst = view().peek(keylet::account(uDstAccountID));
|
||||
|
||||
if (!sleDst)
|
||||
|
||||
Reference in New Issue
Block a user