Skip to main content

initialize_handler

Function initialize_handler 

Source
pub fn initialize_handler(
    ctx: Context<'_, '_, '_, '_, Initialize<'_>>,
    pubkey_g2: [u8; 128],
    genesis_time: u64,
    period: u64,
    chain_hash: [u8; 32],
) -> Result<()>
Expand description

initialize handler — sets up the Config PDA with evmnet parameters.

Guards (ADR 0031 + ADR 0027 fallback + Wave X+1 FENDER-002 hardening):

  • authority == program_data.upgrade_authority_address (6012) — closes the deploy-to-init front-run window. Only the entity that controls the program’s upgrade authority (the deployer pre-transition, the Squads 2-of-3 multisig post-transition per ADR 0009) can initialize. Without this check, anyone watching the mempool between solana program deploy confirmation and the initialize tx could submit their own initialize with the correct (public) evmnet constants and capture permanent authority (ADR 0009 forbids rotation in update_config).
  • chain_hash == EXPECTED_EVMNET_CHAIN_HASH (6007) — prevents wrong-chain deployment.
  • pubkey_g2 == EXPECTED_EVMNET_PUBKEY (6008) — OPEN-ITEMS #4 RESOLVED 2026-04-16: fallback path chosen because the primary is_in_correct_subgroup_assuming_on_curve exceeds 1.4M CU on BPF. Key rotation requires a program upgrade.