CI rehearsal only (do not merge) - #21
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.
|
| if let Some(account_type) = buffer.get_mut(spl_token_2022_interface::state::Account::LEN) { | ||
| *account_type = 0; | ||
| } |
There was a problem hiding this comment.
Wrong mint marker offset When
setMint adds confidential support to a Token-2022 mint that already has extensions, this clears byte 165 instead of the mint’s account-type byte at offset 82. The existing marker remains set, so unpack_uninitialized rejects the buffer and the update fails.
| if let Some(account_type) = buffer.get_mut(spl_token_2022_interface::state::Account::LEN) { | |
| *account_type = 0; | |
| } | |
| if let Some(account_type) = buffer.get_mut(spl_token_2022_interface::state::Mint::LEN) { | |
| *account_type = 0; | |
| } |
| if confidential.is_some() && account.owner != token_program_id { | ||
| return Err(Error::invalid_params(format!( | ||
| "mint {mint} is owned by {}, not the Token-2022 program", | ||
| account.owner | ||
| ))); | ||
| } |
There was a problem hiding this comment.
Plain updates ignore mint ownership If a caller omits
tokenProgram while updating an existing Token-2022 mint, setMint selects the legacy SPL Token program but skips the owner check because the update is not confidential. It reports success and rewrites the mint while leaving its Token-2022 owner unchanged, hiding the program mismatch from callers that subsequently use the requested program.
| #[cfg_attr( | ||
| feature = "ts-bindings", | ||
| derive(ts_rs::TS), | ||
| ts(export, optional_fields) |
There was a problem hiding this comment.
Fork CI only. Do not merge.