Skip to content

feat(client): add local account removal - #2723

Open
0xrouss-miden wants to merge 2 commits into
0xMiden:nextfrom
0xrouss-miden:pablo/remove-local-account
Open

0xrouss-miden wants to merge 2 commits into
0xMiden:nextfrom
0xrouss-miden:pablo/remove-local-account

Conversation

@0xrouss-miden

Copy link
Copy Markdown

Services that import accounts for a one-off read can now remove the local copy through Client::remove_account. This covers the Rust side of #2721; TS/Node bindings are separate work.

Removal deletes the account's current state, history, addresses, and witness registration. Its derived note tags disappear with its addresses. Notes, transaction records, signing keys, and shared account code remain available. The operation is atomic, rejects accounts with pending transactions, and returns false if the account is already absent. It leaves the on-chain account unchanged, so public accounts can be imported again.

The change also removes unused map trees when history is pruned or a transaction is discarded, including empty maps. After a discard, the cached forest is refreshed so another update in the same sync can recreate the map.

Custom stores must implement Store::remove_account. Exhaustive error matches must also handle the new StoreError::AccountHasPendingTransactions variant.

Validation:

  • make lint passed. Cargo-shear reported the existing warning about the empty integration-test library harness.
  • cargo test --workspace --release --lib --features "std dap": 658 passed, 2 ignored.
  • make test-docs: 12 passed, 16 ignored.
  • make doc passed with rustdoc warnings denied.

Live-node integration tests were not run.

@Dominik1999

Copy link
Copy Markdown
Collaborator

Do we need this on the web SDK as well?

@igamigo

igamigo commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator

Some general points:

  • If we want this on a patch, we'll need to rebase from main
  • What is the reasoning for leaving transaction data in the store?
  • Why is the feature blocked on whether accounts have pending transactions? If we are forgetting about it, we probably should not care about those.
  • I left some comments on the issue to better understand the need for this feature.

This branch has not been deployed

No deployments
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

Successfully merging this pull request may close these issues.

3 participants