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

Add capability to freeze token Accounts #297

Merged
merged 22 commits into from
Aug 25, 2020

Conversation

CriesofCarrots
Copy link
Contributor

An authority may want the ability to "freeze" specific accounts.

Add a new authority to the Mint and a new initialized state variant to Account. The authority is able to toggle that variant for an associated account. Setting the variant to "frozen" disables any changes from being made to the account, ie transfer in or out, approve, revoke, set-authority, burn.

Fixes #229

@CriesofCarrots
Copy link
Contributor Author

CriesofCarrots commented Aug 21, 2020

@mvines @jackcmay , wdyt?

Also:

  • Currently, it is the same instruction to freeze and account as it is to unfreeze: ToggleFreeze. We could split into two, or ask the user to pass a parameter to indicate which action is intended, if we want extra assurance that the account is intended to be frozen (or unfrozen). Thoughts?
    Update: parameter added
  • Currently, only the freeze_authority can sign to update the freeze_authority on the Mint. I considered giving this power to the Mint owner as well, but it seemed a little unnecessary to me. Does that sound okay?

token/program2/src/instruction.rs Outdated Show resolved Hide resolved
token/program2/src/instruction.rs Outdated Show resolved Hide resolved
token/program2/src/instruction.rs Outdated Show resolved Hide resolved
@mvines
Copy link
Member

mvines commented Aug 21, 2020

  • Currently, it is the same instruction to freeze and account as it is to unfreeze: ToggleFreeze. We could split into two, or ask the user to pass a parameter to indicate which action is intended, if we want extra assurance that the account is intended to be frozen (or unfrozen). Thoughts?

I far prefer passing a parameter.

  • Currently, only the freeze_authority can sign to update the freeze_authority on the Mint. I considered giving this power to the Mint owner as well, but it seemed a little unnecessary to me. Does that sound okay?

Keeping the authorities completely separate seems ok to me. Freeze is arguably more powerful than Mint, but I like the idea of not having to order them

token/program2/src/processor.rs Show resolved Hide resolved
token/program2/src/processor.rs Outdated Show resolved Hide resolved
@jackcmay
Copy link
Contributor

While you have eyes on the token program, open to any way to reduce the loads of copypasta in the tests

@CriesofCarrots
Copy link
Contributor Author

@jackcmay @mvines , ready for another look!

While you have eyes on the token program, open to any way to reduce the loads of copypasta in the tests

I'll take a look! Separate pr.

@CriesofCarrots
Copy link
Contributor Author

Bump @jackcmay @mvines

@CriesofCarrots CriesofCarrots force-pushed the token-freeze branch 3 times, most recently from d48e3d1 to 2c4a6b9 Compare August 25, 2020 16:25
@CriesofCarrots
Copy link
Contributor Author

@mvines @jackcmay got the COption clean up in and CI is happy. How is this looking?

jackcmay
jackcmay previously approved these changes Aug 25, 2020
Copy link
Member

@mvines mvines left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking really good overall

@mergify mergify bot dismissed jackcmay’s stale review August 25, 2020 18:04

Pull request has been modified.

@CriesofCarrots CriesofCarrots merged commit c00adbe into solana-labs:master Aug 25, 2020
@CriesofCarrots CriesofCarrots deleted the token-freeze branch September 24, 2020 19:22
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.

No mechanism for freezing token accounts
3 participants