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_SEEDwith bump).Mutable: Yes.
Constraints: Must be a new account initialized with space
8 + 144(discriminator +ContractStoragesize).
Additional checks and behavior
Checks that
crate::IDis not[0; 32].Creates and stores a
ContractStorageaccount with the values from the input parameters.
CPI
N/A.