Skip to content

Add an Invariant check that a deleted account has no traceable objects left on the ledger. #4638

@ximinez

Description

@ximinez

Summary

Add a new class to InvariantCheck.h/cpp that finds any deleted AccountRoots (there should only be one, of course) and attempts to read the directory root, and any other objects that can be accessed directly (e.g. the SignerList, NFT page... that might be all of them).

Motivation

The first version of AMM (#4294) support merged to develop did not delete the AMM AccountRoot correctly. Fortunately, this was discovered and reported, and a fix is in progress (#4626). During the review of the second PR, it occurred to me that this issue would have been avoided if there was an invariant to verify if a deleted account has no "artifacts" left on the ledger. (#4626 (comment))

Solution

Create a new invariant class (possible name CompletelyDeletedAccount). Use the visitEntry function to build a vector of deleted AccountRoots (There should only be one, but that's checked by the existing AccountRootsNotDeleted class). Use the finalize function to attempt to read any directly accessible objects from the view. "Directly accessible" in this case means any object that can be addressed (via a Keylet) using only the sfAccountID. That includes, but is not necessarily limited to:

  • Keylet ownerDir(AccountID const& id) noexcept;
  • Keylet signers(AccountID const& account) noexcept;
  • Keylet nftpage_min(AccountID const& owner);
  • Keylet nftpage_max(AccountID const& owner);

Edit: And don't forget to check the for an AMM object if AMMID is populated.

Metadata

Metadata

Assignees

Labels

Feature RequestUsed to indicate requests to add new features

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions