Compare commits

...

6 Commits

Author SHA1 Message Date
Mayukha Vadari
51c9c663e9 Keep SignerList helpers in SignerListSet
Move removeSignersFromLedger, signerCountBasedOwnerCountDelta,
SignerListSet::removeFromLedger, writeSignersToSLE and
kDefaultSignerListId back to SignerListSet.cpp with develop's bodies and
journals, and restore AccountDelete's call to
SignerListSet::removeFromLedger. Delete SignerListEntry::setSigners,
removeFromLedger and SignerListEntry.cpp, and revert the SLEBase test
instantiation change that only existed for them.

The PR is now a pointer-only migration: SignerListEntryR/W replace raw
SLE pointers, with no new member functions on the wrapper.
2026-10-07 21:04:05 +01:00
Mayukha Vadari
d4cec6fabe Include Keylet.h in the SLEBase test
(cherry picked from commit 3cca9d3266)
2026-10-05 14:37:23 +01:00
Mayukha Vadari
b911bcdba2 test: Drop extern template declarations from SLEBase test
An explicit instantiation declaration stops clang from emitting the
inline constructors of the header-only entries at -O0, so the debug
builds fail to link xrpl_tests (undefined AccountRootEntry constructors).
Naming each class in a static_assert already instantiates its definition,
which is all the exhaustiveness check needs.

(cherry picked from commit 611415e1f9)
2026-10-05 14:37:23 +01:00
Mayukha Vadari
070d3534a1 test: Declare, not define, entry instantiations in SLEBase test
The exhaustive per-entry-type check in the SLEBase gtest used explicit
instantiation definitions. Once an entry class gets out-of-line member
bodies in its own .cpp (with the explicit instantiation definition
there), the test would instantiate the class a second time, and MSVC
rejects it with C4661 because those member bodies are not visible in
the test translation unit. Explicit instantiation declarations still
instantiate the class definition, which is all the check needs.

(cherry picked from commit 8b07abc3cd)
2026-10-05 13:40:21 +01:00
Mayukha Vadari
78633d33fa refactor: Drop ServiceRegistry param from SignerListEntry::removeFromLedger
SignerListEntry::removeFromLedger took a ServiceRegistry& only to source
the "View" journal partition for its owner-count log message. Pass that
journal to the SignerListEntryW constructor at each call site instead
(matching PR #8350's PayChannel entries) and use this->journal() inside
the member, so the signature drops to removeFromLedger(AccountID const&
owner).
2026-10-05 13:40:20 +01:00
Mayukha Vadari
e637027207 refactor: Use SignerListEntry everywhere
Migrate every read/peek/insert/update/erase of the SignerList ledger
entry (SignerListSet.cpp, the multi-sign check in Transactor.cpp,
AccountDelete.cpp's deleter table, TransactionProposalCreate.cpp,
AccountSet.cpp, SetRegularKey.cpp, and SponsorHelpers.cpp) to the
SignerListEntryR/SignerListEntryW wrapper.

Also move SignerListSet's two SLE-writing helpers onto the wrapper:
writeSignersToSLE becomes SignerListEntry::setSigners (taking a
pre-built STArray of signer entries rather than the tx-layer
SignerEntries::SignerEntry vector, since the ledger module cannot
depend on the tx module), and the shared removeSignersFromLedger body
used by SignerListSet::{replace,destroy}SignerList and by
AccountDelete's deleter table becomes SignerListEntry::removeFromLedger.

Pure refactor: no behavior change.
2026-10-05 13:40:20 +01:00
7 changed files with 26 additions and 15 deletions

View File

@@ -4,6 +4,7 @@
#include <xrpl/core/ServiceRegistry.h>
#include <xrpl/ledger/ApplyView.h>
#include <xrpl/ledger/ReadView.h>
#include <xrpl/ledger/entries/SignerListEntry.h>
#include <xrpl/protocol/AccountID.h>
#include <xrpl/protocol/Rules.h>
#include <xrpl/protocol/STTx.h>
@@ -87,7 +88,7 @@ private:
destroySignerList();
void
writeSignersToSLE(SLE::pointer const& ledgerEntry, std::uint32_t flags) const;
writeSignersToSLE(SignerListEntryW& ledgerEntry, std::uint32_t flags) const;
};
} // namespace xrpl

View File

@@ -3,6 +3,7 @@
#include <xrpl/beast/utility/instrumentation.h>
#include <xrpl/ledger/ApplyView.h>
#include <xrpl/ledger/ReadView.h>
#include <xrpl/ledger/entries/SignerListEntry.h>
#include <xrpl/ledger/helpers/AccountRootHelpers.h>
#include <xrpl/ledger/helpers/OracleHelpers.h>
#include <xrpl/ledger/helpers/ProposalHelpers.h>
@@ -230,10 +231,10 @@ isLedgerEntryOwner(ReadView const& view, SLE const& sle, AccountID const& accoun
case ltMPTOKEN_ISSUANCE:
return sle.getAccountID(sfIssuer) == account;
case ltSIGNER_LIST: {
auto const signerList = view.read(keylet::signerList(account));
SignerListEntryR const signerList(account, view);
if (!signerList)
return false;
return signerList->key() == sle.key();
return signerList.key() == sle.key();
}
case ltCREDENTIAL: {
auto const& ownerField = sle.isFlag(lsfAccepted) ? sfSubject : sfIssuer;

View File

@@ -11,6 +11,7 @@
#include <xrpl/json/to_string.h> // IWYU pragma: keep
#include <xrpl/ledger/ApplyView.h>
#include <xrpl/ledger/ReadView.h>
#include <xrpl/ledger/entries/SignerListEntry.h>
#include <xrpl/ledger/helpers/AccountRootHelpers.h>
#include <xrpl/ledger/helpers/CredentialHelpers.h>
#include <xrpl/ledger/helpers/DelegateHelpers.h>
@@ -1056,7 +1057,7 @@ Transactor::checkMultiSign(
beast::Journal const j)
{
// Get id's SignerList and Quorum.
STLedgerEntry::const_pointer const sleAccountSigners = view.read(keylet::signerList(id));
SignerListEntryR const sleAccountSigners(id, view);
// If the signer list doesn't exist the account is not multi-signing.
if (!sleAccountSigners)
{

View File

@@ -6,6 +6,7 @@
#include <xrpl/basics/base_uint.h>
#include <xrpl/ledger/ApplyView.h>
#include <xrpl/ledger/ReadView.h>
#include <xrpl/ledger/entries/SignerListEntry.h>
#include <xrpl/ledger/helpers/DirectoryHelpers.h>
#include <xrpl/protocol/Feature.h>
#include <xrpl/protocol/Indexes.h>
@@ -312,7 +313,7 @@ AccountSet::doApply()
return tecNEED_MASTER_KEY;
}
if ((!sle->isFieldPresent(sfRegularKey)) && (!view().peek(keylet::signerList(accountID_))))
if ((!sle->isFieldPresent(sfRegularKey)) && (!SignerListEntryW(accountID_, view())))
{
// Account has no regular key or multi-signer signer list.
return tecNO_ALTERNATIVE_KEY;

View File

@@ -3,6 +3,7 @@
#include <xrpl/basics/Slice.h>
#include <xrpl/beast/utility/Journal.h>
#include <xrpl/ledger/ReadView.h>
#include <xrpl/ledger/entries/SignerListEntry.h>
#include <xrpl/protocol/Indexes.h>
#include <xrpl/protocol/LedgerFormats.h>
#include <xrpl/protocol/PublicKey.h>
@@ -67,7 +68,7 @@ SetRegularKey::doApply()
else
{
// Account has disabled master key and no multi-signer signer list.
if (sle->isFlag(lsfDisableMaster) && !view().peek(keylet::signerList(accountID_)))
if (sle->isFlag(lsfDisableMaster) && !SignerListEntryW(accountID_, view()))
return tecNO_ALTERNATIVE_KEY;
sle->makeFieldAbsent(sfRegularKey);

View File

@@ -6,6 +6,7 @@
#include <xrpl/core/ServiceRegistry.h>
#include <xrpl/ledger/ApplyView.h>
#include <xrpl/ledger/ReadView.h>
#include <xrpl/ledger/entries/SignerListEntry.h>
#include <xrpl/ledger/helpers/AccountRootHelpers.h>
#include <xrpl/ledger/helpers/DirectoryHelpers.h>
#include <xrpl/ledger/helpers/SponsorHelpers.h>
@@ -28,7 +29,6 @@
#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <memory>
#include <tuple>
#include <utility>
#include <vector>
@@ -186,7 +186,7 @@ removeSignersFromLedger(
{
// We have to examine the current SignerList so we know how much to
// reduce the OwnerCount.
SLE::pointer const signers = view.peek(signerListKeylet);
SignerListEntryW signers(signerListKeylet, view, j);
// If the signer list doesn't exist we've already succeeded in deleting it.
if (!signers)
@@ -214,9 +214,13 @@ removeSignersFromLedger(
}
decreaseOwnerCountForObject(
view, view.peek(accountKeylet), signers, removeFromOwnerCount, registry.getJournal("View"));
view,
view.peek(accountKeylet),
signers.mutableRawSle(),
removeFromOwnerCount,
registry.getJournal("View"));
view.erase(signers);
signers.erase();
return tesSUCCESS;
}
@@ -329,8 +333,9 @@ SignerListSet::replaceSignerList()
return ret;
// Everything's ducky. Add the ltSIGNER_LIST to the ledger.
auto signerList = std::make_shared<SLE>(signerListKeylet);
view().insert(signerList);
SignerListEntryW signerList(signerListKeylet, view(), j_);
signerList.newSLE();
signerList.insert();
writeSignersToSLE(signerList, flags);
auto viewJ = ctx_.registry.get().getJournal("View");
@@ -349,7 +354,7 @@ SignerListSet::replaceSignerList()
// If we succeeded, the new entry counts against the
// creator's reserve.
increaseOwnerCount(ctx_.getApplyViewContext(), sle, kAddedOwnerCount, viewJ);
addSponsorToLedgerEntry(ctx_.getApplyViewContext(), signerList);
addSponsorToLedgerEntry(ctx_.getApplyViewContext(), signerList.mutableRawSle());
return tesSUCCESS;
}
@@ -373,7 +378,7 @@ SignerListSet::destroySignerList()
}
void
SignerListSet::writeSignersToSLE(SLE::pointer const& ledgerEntry, std::uint32_t flags) const
SignerListSet::writeSignersToSLE(SignerListEntryW& ledgerEntry, std::uint32_t flags) const
{
// Assign the quorum, default SignerListID, and flags.
if (ctx_.view().rules().enabled(fixIncludeKeyletFields))

View File

@@ -4,6 +4,7 @@
#include <xrpl/core/ServiceRegistry.h>
#include <xrpl/ledger/ApplyView.h>
#include <xrpl/ledger/View.h>
#include <xrpl/ledger/entries/SignerListEntry.h>
#include <xrpl/ledger/helpers/AccountRootHelpers.h>
#include <xrpl/ledger/helpers/DirectoryHelpers.h>
#include <xrpl/ledger/helpers/ProposalHelpers.h>
@@ -185,7 +186,7 @@ TransactionProposalCreate::preclaim(PreclaimContext const& ctx)
if (proposer == account)
return true;
auto const sleSigners = ctx.view.read(keylet::signerList(account));
SignerListEntryR const sleSigners(account, ctx.view);
if (!sleSigners)
return false;