Assessment reports>N1 Bridge>Threat Model>Instruction: initialize

Instruction: initialize

This instruction initializes the global contract storage.

Input parameters

  • operator: Pubkey: The public key for the bridge operator role.

  • challenge_period_slots: u64: The number of slots where a block can be challenged before it is finalized.

  • app_state_commitment: [u8; 32]: The initial app state commitment value.

Accounts

  • payer: The signer for this transaction who pays account-creation fees.

    • Signer: Yes.

    • Init: No.

    • PDA: No.

    • Mutable: Yes.

    • Constraints: Must have sufficient lamports to cover the account-creation cost.

  • program: The bridge program.

    • Signer: Yes.

    • Init: No.

    • PDA: No.

    • Mutable: No.

    • Constraints: Must be an account with the address crate::ID (which should be the bridge program).

  • contract_storage: The global contract storage.

    • Signer: No.

    • Init: Yes.

    • PDA: Yes (derived from CONTRACT_STORAGE_SEED with bump).

    • Mutable: Yes.

    • Constraints: Must be a new account initialized with space 8 + 144 (discriminator + ContractStorage size).

Additional checks and behavior

  • Checks that crate::ID is not [0; 32].

  • Creates and stores a ContractStorage account with the values from the input parameters.

CPI

N/A.

Zellic © 2025Back to top ↑