token: Add close_authority and re-enable CloseAccount for non-native Accounts #314
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There are cases when the SOL required for rent at the creation of an SPL token account will be subsidized by a 3rd party, opening the door for a financial attack where users request token accounts from the subsidizer only to immediately close them in order to drain SOL from the subsidizer.
Our previous solution to this attack was to disable CloseAccount for non-native accounts, locking that SOL forever.
This PR re-enables CloseAccount for non-native accounts, and adds an Account::close_authority, enabling a 3rd party as above to reclaim their SOL when an account has 0 token balance.
Also adds a couple clarifying comments to the mint section of process_set_authority
Closes #302
Reverts #127