fix: Revert credential cleanup for pseudo-accounts (#8161)

This commit is contained in:
Timur Yalymov
2026-09-02 15:00:50 +00:00
committed by GitHub
parent 346ea40f69
commit 5d8fd9824e
12 changed files with 4 additions and 413 deletions

View File

@@ -4,7 +4,6 @@
#include <test/jtx/Env.h>
#include <test/jtx/TestHelpers.h>
#include <test/jtx/amount.h>
#include <test/jtx/credentials.h>
#include <test/jtx/envconfig.h>
#include <test/jtx/escrow.h>
#include <test/jtx/fee.h>
@@ -5193,51 +5192,6 @@ private:
{features});
}
void
testCredentialPinsPseudoAccount()
{
testcase("Credential pins AMM pseudo-account");
using namespace jtx;
FeatureBitset const all{testableAmendments()};
// A credential issued to an AMM pseudo-account can't be accepted or
// deleted by it. A pin created before the cure activates stays pinned
// in the pseudo-account's owner directory and makes AMM deletion fail
// with tecINTERNAL (deleteAMMTrustLines rejects the unexpected
// directory entry).
Account const attacker{"attacker"};
char const credType[] = "FN36";
Env env(*this, all - fixCleanup3_3_0 - fixCleanup3_4_0);
fund(env, gw_, {alice_}, XRP(20'000), {USD(10'000)});
env.fund(XRP(1'000), attacker);
env.close();
AMM amm(env, alice_, XRP(10'000), USD(10'000));
Account const ammAcct{"amm pseudo-account", amm.ammAccount()};
env.memoize(ammAcct);
env(credentials::create(ammAcct, attacker, credType));
env.close();
auto const credKey = credentials::keylet(ammAcct, attacker, credType);
BEAST_EXPECT(env.le(credKey));
// Emptying the AMM would auto-delete it, but the pinned credential makes
// deleteAMMAccount fail; the withdraw is rolled back and the AMM stays.
amm.withdrawAll(alice_, std::nullopt, Ter(tecINTERNAL));
BEAST_EXPECT(amm.ammExists());
env.enableFeature(fixCleanup3_4_0);
env.close();
// The pre-existing pin is cleaned up and the AMM deletes.
amm.withdrawAll(alice_);
BEAST_EXPECT(!amm.ammExists());
BEAST_EXPECT(!env.le(credKey));
BEAST_EXPECT(!env.le(keylet::ownerDir(amm.ammAccount())));
}
void
testAutoDelete()
{
@@ -7505,7 +7459,6 @@ private:
FeatureBitset const all{testableAmendments()};
testInvalidInstance();
testInstanceCreate();
testCredentialPinsPseudoAccount();
for (auto const& f : amendmentCombinations({fixCleanup3_3_0, featureAMMClawback}))
testInvalidDeposit(f);
testDeposit();