Module finalize

Module finalize 

Source
Expand description

LightFinalize and LightPreInit traits for compression operations.

These traits are implemented by the #[derive(LightFinalize)] macro from light-sdk-macros. They provide hooks for running compression operations at different points in an instruction:

  • LightPreInit: Called at START of instruction - creates mints via CPI context write
  • LightFinalize: Called at END of instruction - compresses PDAs and executes with proof

This two-phase design allows mints to be created BEFORE the instruction body runs, so they can be used during the instruction (e.g., for vault creation, minting tokens).

Traitsยง

LightFinalize
Trait for finalizing compression operations on accounts.
LightPreInit
Trait for pre-initialization operations (mint creation).