Skip to content

refactor: remove bump from create mint instruction data#2048

Merged
sergeytimoshin merged 1 commit intomainfrom
jorrit/fix-cmint-custom-bump
Nov 14, 2025
Merged

refactor: remove bump from create mint instruction data#2048
sergeytimoshin merged 1 commit intomainfrom
jorrit/fix-cmint-custom-bump

Conversation

@ananas-block
Copy link
Contributor

@ananas-block ananas-block commented Nov 11, 2025

Issue:

  • create mint passes a bump which allows to create multiple cmint accounts from a single seed provided multiple bumps that result in an offcurve pda exist.

Changes:

  • remove mint_bump from create mint instruction data

Summary by CodeRabbit

Release Notes

  • Refactor
    • Simplified compressed token mint creation by removing mint bump parameters from creation inputs.
    • Updated program-derived address derivation mechanism for token mints.
    • Streamlined internal token creation instruction data structures for improved clarity and efficiency.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 11, 2025

Walkthrough

The pull request removes the mint_bump field from CreateMint-related structures across multiple layers of the codebase, and changes the mint PDA derivation from create_program_address to find_program_address. This eliminates explicit bump seed validation in the create mint flow.

Changes

Cohort / File(s) Summary
Type Definitions
program-libs/ctoken-types/src/instructions/mint_action/instruction_data.rs
Removed mint_bump: u8 field from CreateMint struct, affecting serialization/deserialization of mint action instruction data.
Program Logic
programs/compressed-token/program/src/mint_action/actions/create_mint.rs
Replaced create_program_address with find_program_address for PDA derivation; removed explicit PDA equality check against provided bump; updated control flow to short-circuit on missing create_mint data.
Program Tests
programs/compressed-token/program/tests/mint_action.rs
Changed CreateMint instantiation from explicit field initialization to CreateMint::default() in random data generation.
SDK Input Structures
sdk-libs/compressed-token-sdk/src/instructions/create_compressed_mint/instruction.rs
Removed mint_bump: u8 field from CreateCompressedMintInputs and CreateCompressedMintInputsCpiWrite; updated all mint_action_inputs constructions to set mint_bump to None.
SDK Mint Action Layer
sdk-libs/compressed-token-sdk/src/instructions/mint_action/instruction.rs
Removed mint_bump: u8 field from CreateMintInputs and CreateMintCpiWriteInputs; updated CPI builders to use CreateMint::default() instead of explicit mint_bump initialization.
Client Layer
sdk-libs/token-client/src/instructions/create_mint.rs
Removed mint_bump calculation via find_program_address; simplified imports; removed mint_bump parameter from CreateCompressedMintInputs construction.

Sequence Diagram

sequenceDiagram
    participant Client
    participant SDK as SDK Layer
    participant Program as Program Logic
    participant Chain as Blockchain

    Note over Client,Program: Previous Flow (with mint_bump)
    Client->>SDK: create_mint(seed, bump)
    SDK->>Program: validate bump matches PDA
    Program->>Program: create_program_address(seed, bump)
    Program-->>Chain: Verify PDA matches input

    Note over Client,Program: New Flow (no mint_bump)
    Client->>SDK: create_mint(seed)
    SDK->>Program: derive PDA
    Program->>Program: find_program_address(seed)
    Program-->>Chain: Use derived address directly
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

The changes are cohesive in intent—removing bump seed handling throughout the stack—but require careful verification across multiple layers:

  • Key attention areas:
    • PDA derivation logic change from create_program_address to find_program_address in create_mint.rs—ensure the new derivation enforces single mint per seed as intended
    • Verify that removing the explicit PDA equality check doesn't introduce address validation gaps
    • Confirm all SDK input structures consistently reflect the field removal with no orphaned mint_bump references
    • Check that default CreateMint initialization provides correct zero-values for removed and retained fields

Possibly related PRs

Suggested labels

ai-review

Suggested reviewers

  • sergeytimoshin
  • SwenSchaeferjohann

Poem

🌱 The bump seed takes its final bow,
No more validation chains, just the address now.
From create_program to find's embrace,
One mint per seed claims its rightful place. ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: removing the bump field from the create mint instruction data, which is reflected across all affected files.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 70.00%.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch jorrit/fix-cmint-custom-bump

Comment @coderabbitai help to get the list of available commands and usage tips.

@ananas-block ananas-block marked this pull request as draft November 11, 2025 22:21
@ananas-block ananas-block marked this pull request as ready for review November 14, 2025 16:10
@sergeytimoshin sergeytimoshin merged commit f30d22b into main Nov 14, 2025
54 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Dec 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants