This repository was archived by the owner on Mar 11, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
This repository was archived by the owner on Mar 11, 2025. It is now read-only.
Add rent awareness to spl-token #66
Copy link
Copy link
Closed
Description
Current spl-token is completed rent unaware, which leads to a couple problems:
- If the
Token
account is not rent-exempt,solana-program-library/token/src/state.rs
Lines 19 to 26 in f8f51c1
pub struct Token { /// The total supply of tokens. pub info: TokenInfo, /// Optional token owner, used to mint new tokens. The owner may only /// be provided during token creation. If no owner is present then the token /// has a fixed supply and no further tokens may be minted. pub owner: COption<Pubkey>, } - If the
Account
account is not rent-exempt,solana-program-library/token/src/state.rs
Lines 41 to 52 in f8f51c1
pub struct Account { /// The type of token this account holds. pub token: Pubkey, /// Owner of this account. pub owner: Pubkey, /// Amount of tokens this account holds. pub amount: u64, /// If `delegate` is None, `amount` belongs to this account. /// If `delegate` is Option<_>, `amount` represents the remaining allowance /// of tokens this delegate is authorized to transfer from the `source` account. pub delegate: COption<AccountDelegate>, } Token
account is now wrong.
(1) is probably not a big issue, but (2) certainly is.
Possible solution:
a) Require the Token
account to be rent-exempt
b) Remove the supply
field from Token
account so that an Account
account that is not rent-exempt cannot poison the supply. This increases the burden on Rpc and other clients, as the token supply must now be calculated by enumerating all the Account
accounts for a given token
Metadata
Metadata
Assignees
Labels
No labels