process_initialize_light_config

Function process_initialize_light_config 

Source
pub fn process_initialize_light_config<'info>(
    config_account: &AccountInfo<'info>,
    update_authority: &AccountInfo<'info>,
    rent_sponsor: &Pubkey,
    compression_authority: &Pubkey,
    rent_config: RentConfig,
    write_top_up: u32,
    address_space: Vec<Pubkey>,
    config_bump: u8,
    payer: &AccountInfo<'info>,
    system_program: &AccountInfo<'info>,
    program_id: &Pubkey,
) -> Result<(), ProgramError>
Expand description

Creates a new compressible config PDA

§Security - Solana Best Practice

This function follows the standard Solana pattern where only the program’s upgrade authority can create the initial config. This prevents unauthorized parties from hijacking the config system.

§Arguments

  • config_account - The config PDA account to initialize
  • update_authority - Authority that can update the config after creation
  • rent_sponsor - Account that receives rent from compressed PDAs
  • compression_authority - Authority that can compress/close PDAs
  • rent_config - Rent function parameters
  • write_top_up - Lamports to top up on each write
  • address_space - Address space for compressed accounts (currently 1 address_tree allowed)
  • config_bump - Config bump seed (must be 0 for now)
  • payer - Account paying for the PDA creation
  • system_program - System program
  • program_id - The program that owns the config

§Required Validation (must be done by caller)

The caller MUST validate that the signer is the program’s upgrade authority by checking against the program data account. This cannot be done in the SDK due to dependency constraints.

§Returns

  • Ok(()) if config was created successfully
  • Err(ProgramError) if there was an error