CI rehearsal only (do not merge) - #28
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.
|
| * The authority that approves new confidential accounts and updates this | ||
| * config (base58). Omitted keeps the current value, null when first written. | ||
| */ | ||
| authority?: string, |
| account.data = final_mint_bytes.clone(); | ||
| Ok(()) | ||
| })?; | ||
| svm_locker.apply_account_update(mint_account, AccountUpdatePolicy::Authoritative)?; |
There was a problem hiding this comment.
Concurrent mint updates overwrite changes
If two surfnet_setMint calls read the same mint before either writes, each builds a complete account from its earlier read. The later write can erase the other call’s update, even when the calls change different fields, because the write lock does not cover the read.
| let mut mint_data = MintAccount::unpack(mint_account.expected_data()) | ||
| .map_err(|e| Error::invalid_params(format!("Failed to unpack mint data: {}", e)))?; |
There was a problem hiding this comment.
Uninitialized mint accounts are rejected
If an account is already allocated to a token program but is not initialized as a mint, the missing-account factory does not run. MintAccount::unpack then fails, so surfnet_setMint cannot configure that account, although it can create a mint at an absent address.
Fork CI only. Do not merge.