Skip to content

CI rehearsal only (do not merge) - #29

Open
michael-moffett wants to merge 1 commit into
mainfrom
surfpool-706-setmint
Open

michael-moffett wants to merge 1 commit into
mainfrom
surfpool-706-setmint

Conversation

@michael-moffett

Copy link
Copy Markdown
Member

Fork CI only. Do not merge.

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.
@greptile-apps

greptile-apps Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 4/5

[Medium risk] Adds test-only cheatcode for mint configuration.

The PR should not merge until setMint preserves mint changes made between its read and authoritative write.

Findings

  1. P1 Concurrent mint changes are lost ▶

Summary

Adds surfnet_setMint to create or patch SPL Token and Token-2022 mints, including confidential-transfer mint configuration, with Rust types, SDK bindings, and tests.

  • Existing mint extensions and lamports are intended to be retained during updates.
  • The new read–modify–write path can overwrite a concurrent mint change.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A["setMint request"] --> B["Read or generate mint"]
  B --> C["Patch base fields and optional confidential extension"]
  C --> D["Top up rent"]
  D --> E["Authoritative account write"]
Loading

Reviews (1) · Last reviewed commit: "feat(core): surfnet_setMint cheatcode wi..."

account.data = final_mint_bytes.clone();
Ok(())
})?;
svm_locker.apply_account_update(mint_account, AccountUpdatePolicy::Authoritative)?;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Concurrent mint changes are lost

If a transaction changes the mint after setMint reads it but before this authoritative write, setMint replaces the whole account with its earlier copy. For example, a decimals-only update can restore the old supply after a concurrent mintTo, losing the supply increase. Coordinate the read and write so fields outside the requested update are preserved.

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.

1 participant