Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Account with 0 XRP Balance Not Deleted on XRPL Mainnet (Version: 2.3.1) #5273

Open
j-craggy opened this issue Feb 2, 2025 · 8 comments
Open

Comments

@j-craggy
Copy link

j-craggy commented Feb 2, 2025

Issue Description

On the XRPL mainnet, an account (rDi3cUzdYa1bdkNdtYdSc2Db5wjYsjz3vH) that should have been deleted due to a 0 XRP balance remains active. According to XRPL protocol rules, an account should be removed from the ledger once its balance reaches 0, provided there are no additional dependencies (trust lines, escrows, AMM positions, etc.).

Steps to Reproduce

Perform an AMM Withdraw transaction that removes liquidity and leaves the account with 0 XRP.

Verify the account status using:

rippled account_info rDi3cUzdYa1bdkNdtYdSc2Db5wjYsjz3vH

Observe that the account still exists despite having a 0 balance.

Check for possible dependencies:

rippled account_lines rDi3cUzdYa1bdkNdtYdSc2Db5wjYsjz3vH
rippled account_objects rDi3cUzdYa1bdkNdtYdSc2Db5wjYsjz3vH
rippled amm_info rDi3cUzdYa1bdkNdtYdSc2Db5wjYsjz3vH

No remaining dependencies are found, yet the account is still present on the ledger.

Expected Result

The account should be deleted from the ledger once it reaches 0 XRP and has no remaining dependencies.

Actual Result

The account remains on the ledger despite having a 0 XRP balance and no known dependencies.

Environment

Supporting Files

logged
2025-Feb-02 14:39:03.452658577 UTC LedgerConsensus:WRN Trying to thread to deleted node
2025-Feb-02 14:39:03.452662772 UTC LedgerConsensus:WRN Threading to non-existent account: rDi3cUzdYa1bdkNdtYdSc2Db5wjYsjz3vH

Screenshot of account_info confirming 0 balance

Image

Screenshot of the transaction history showing the AMM Withdraw

Image

Additional Notes

This issue may be related to AMM interactions or an edge case in the ledger’s deletion logic.

@mvadari
Copy link
Collaborator

mvadari commented Feb 3, 2025

Technically an account can have 0 XRP if it burns its balance with fees.

@j-craggy
Copy link
Author

j-craggy commented Feb 3, 2025

Technically an account can have 0 XRP if it burns its balance with fees.

XRPL enforces a reserve requirement specifically to prevent spam and abuse. If an account could exist with a zero balance, it would undermine that mechanism by allowing "ghost" accounts to persist without cost.

Given this:

  • What condition(s) are preventing the account from being deleted.
  • Is there an AMM-related reserve or another mechanism keeping it active?
  • If this is expected behavior, where is it documented.

@mvadari
Copy link
Collaborator

mvadari commented Feb 3, 2025

Ok I just looked at the account and it's actually deleted, if you look at the metadata of the AMMWithdraw transaction. This account is an AMM pseudo-account, not a normal account, so the rules are different.

There is a known bug in the Explorer (ripple/explorer#1061) where it doesn't show deleted accounts properly.

@mvadari
Copy link
Collaborator

mvadari commented Feb 3, 2025

The ability for an account's balance to go below its reserve is documented here: https://xrpl.org/docs/concepts/accounts/reserves#base-reserve-and-owner-reserve

@ximinez
Copy link
Collaborator

ximinez commented Feb 11, 2025

According to XRPL protocol rules, an account should be removed from the ledger once its balance reaches 0, provided there are no additional dependencies (trust lines, escrows, AMM positions, etc.).

Just to be explicit, there is no such general rule, nor has there ever been. A normal account can only be deleted by an AccountDelete transaction. Pseudo-accounts, such as the AMM account in this case, can be deleted through other means, depending on their specific feature logic.

@j-craggy
Copy link
Author

According to XRPL protocol rules, an account should be removed from the ledger once its balance reaches 0, provided there are no additional dependencies (trust lines, escrows, AMM positions, etc.).

Just to be explicit, there is no such general rule, nor has there ever been. A normal account can only be deleted by an AccountDelete transaction. Pseudo-accounts, such as the AMM account in this case, can be deleted through other means, depending on their specific feature logic.

While I understand there’s no general rule for automatic account deletion, the issue I’m concerned about is the potential for excessive spam accounts to exist, especially with 0-balance AMM accounts. If accounts with zero balances can continue to exist indefinitely without any cleanup, even if they don’t have active dependencies, it could lead to a bloat of "ghost" accounts over time.

While I know accounts can be deleted via AccountDelete transactions or through specific logic for pseudo-accounts, what prevents the system from getting clogged with these inactive accounts that are just taking up space in the ledger? Especially since creating an account requires a transaction, but there doesn't seem to be an automatic cleanup for those with no activity or balance.

@mvadari
Copy link
Collaborator

mvadari commented Feb 11, 2025

especially with 0-balance AMM accounts

0-balance AMM accounts shouldn't exist (unless they're an IOU-IOU AMM, in which case they won't have any XRP balance).

While I know accounts can be deleted via AccountDelete transactions or through specific logic for pseudo-accounts, what prevents the system from getting clogged with these inactive accounts that are just taking up space in the ledger? Especially since creating an account requires a transaction, but there doesn't seem to be an automatic cleanup for those with no activity or balance.

An account can only have a lower balance than its reserve if it burns all that XRP. That's a rare enough occurrence.

@ximinez
Copy link
Collaborator

ximinez commented Feb 11, 2025

An account can only have a lower balance than its reserve if it burns all that XRP. That's a rare enough occurrence.

One of the design philosophies of the XRPL is to not necessarily prevent certain types of attacks, but to make them so expensive as to not be worth it to the attacker. Creating a bunch of accounts only to burn the reserve would cost 20XRP per account, which is currently worth around 50 USD. That adds up fast.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
@ximinez @mvadari @j-craggy and others