Skip to content

Add rent-reclaim plugin suite: scan (T0) + build (T1) for reclaiming rent from empty token accounts#131

Open
uditjainstjis wants to merge 1 commit into
zeroclaw-labs:mainfrom
uditjainstjis:rent-reclaim-plugins
Open

Add rent-reclaim plugin suite: scan (T0) + build (T1) for reclaiming rent from empty token accounts#131
uditjainstjis wants to merge 1 commit into
zeroclaw-labs:mainfrom
uditjainstjis:rent-reclaim-plugins

Conversation

@uditjainstjis

Copy link
Copy Markdown

What

Two new plugins that recover the ~0.002 SOL rent locked in empty SPL / Token-2022 token accounts:

  • rent-reclaim-scan (T0, read-only): scans a wallet's token accounts and reports reclaimable rent (count, per-account breakdown, total SOL).
  • rent-reclaim-build (T1, tx-builder): builds an unsigned transaction closing the selected empty accounts, rent returned strictly to the account owner.

Custody & injection safety

The rent destination is not a parameter anywhere in the schema, core, or encoder — it is hard-wired to the account owner, so prompt injection provably cannot redirect funds. A smuggled destination field fails closed via deny_unknown_fields; non-empty, foreign, or frozen accounts are refused all-or-nothing. READMEs include the threat model and a prompt-injection test transcript.

Testing

  • 23 unit tests across both plugins (RPC mocked), including fail-closed injection tests and an independent wire-format decoder asserting destination == owner at the byte level
  • cargo build --locked --target wasm32-wasip2 --release green for both (~360/385 KB)
  • fmt + clippy clean; tools/tests and build-registry.py --check-metadata pass
  • Live proof: scan core run against a real mainnet wallet (3049 token accounts); the built unsigned tx passes mainnet simulateTransaction with err: null (real outputs embedded in the READMEs)

…laim rent from empty Solana token accounts

Two tool plugins for the Solana bounty:

- rent-reclaim-scan (T0, read-only): finds empty SPL/Token-2022 token
  accounts and reports the reclaimable rent-exempt SOL, shaped to a few
  hundred tokens of output.
- rent-reclaim-build (T1, no keys): builds an unsigned transaction that
  closes verified-empty accounts. The rent destination is not a
  parameter anywhere in the schema, core, or encoder — it is always the
  owner, so prompt injection cannot redirect funds. Verification is
  all-or-nothing and fail-closed.

Pure core / thin shim per plugins/redact-text; hand-rolled legacy tx
encoding (compact-u16, ComputeBudget, CloseAccount) with an independent
decoder in the tests; waki over wasi:http; RPC mocked in all host tests;
output of build verified via mainnet simulateTransaction (err: null).
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.

2 participants