CI rehearsal only (do not merge) - #22
michael-moffett wants to merge 1 commit into
Conversation
Add a `surfnet_setMint` cheatcode that creates or patches a mint, optionally writing the Token-2022 `ConfidentialTransferMint` extension (authority, auditor ElGamal pubkey, auto-approve). Lead 3 of : builders must fork a mainnet mint today because there is no way to spin up a confidential-capable mint with a chosen auditor and decimals.
|
| let token_program_id = mint_account.clone().map_account()?.owner; | ||
| if let Some(requested) = | ||
| requested_token_program.filter(|requested| *requested != token_program_id) | ||
| { | ||
| return Err(Error::invalid_params(format!( | ||
| "mint {mint} is owned by {token_program_id}, not the requested token program {requested}" | ||
| ))); | ||
| } |
There was a problem hiding this comment.
Unsupported mint owner accepted
If an existing account has mint-shaped data but is owned by neither SPL Token nor Token-2022, calling setMint without tokenProgram accepts that owner. The update writes mint data but leaves the owner unchanged, so the RPC reports success while token programs cannot use the account as a mint. Reject unsupported owners before writing the update.
| /// The authority that approves new confidential accounts and updates this | ||
| /// config (base58). Omitted keeps the current value, null when first written. | ||
| pub authority: Option<String>, |
There was a problem hiding this comment.
Confidential authority cannot be cleared
After a confidential mint authority is set, callers have no way to clear it. JSON null becomes None, which the update treats as “leave unchanged.” Unlike the auditor field, authority cannot distinguish an omitted value from an explicit null. This limits later configuration changes; give callers a distinct way to request clearing it.
Fork CI only. Do not merge.