pub struct Initialize<'info> {
pub config: Account<'info, Config>,
pub authority: Signer<'info>,
pub program_data: Account<'info, ProgramData>,
pub system_program: Program<'info, System>,
}Expand description
Accounts for the initialize instruction.
Creates the singleton Config PDA at seeds ["config"] with the
program’s on-chain upgrade authority as authority. The init
constraint returns Anchor’s built-in “account already in use”
runtime error on duplicate initialization (T3.22).
Wave X+1 / FENDER-002 hardening (Codex Session C, 2026-04-17):
program_data is the BPFLoaderUpgradeable ProgramData account
derived at [crate::ID] seeds in the loader program. It exposes
the program’s upgrade_authority_address field. The handler
requires authority.key() == program_data.upgrade_authority_address
so only the entity that deployed the program (or holds the current
upgrade authority, e.g. Squads multisig post-transition per ADR 0009)
can initialize. This closes the deploy-to-init front-run window
physically at the program level; scripts/initialize.ts becomes
a convenience wrapper rather than the sole mitigation.
Fields§
§config: Account<'info, Config>§program_data: Account<'info, ProgramData>ProgramData account for the Alea program. Anchor derives the PDA
from [crate::ID] under the BPFLoaderUpgradeable program and
deserializes the upgrade_authority_address field. Any caller
whose authority pubkey does not match that field is rejected
with AleaError::UnauthorizedInit (6012).
system_program: Program<'info, System>Trait Implementations§
Source§impl<'info> Accounts<'info, InitializeBumps> for Initialize<'info>where
'info: 'info,
impl<'info> Accounts<'info, InitializeBumps> for Initialize<'info>where
'info: 'info,
Source§fn try_accounts(
__program_id: &Pubkey,
__accounts: &mut &'info [AccountInfo<'info>],
__ix_data: &[u8],
__bumps: &mut InitializeBumps,
__reallocs: &mut BTreeSet<Pubkey>,
) -> Result<Self>
fn try_accounts( __program_id: &Pubkey, __accounts: &mut &'info [AccountInfo<'info>], __ix_data: &[u8], __bumps: &mut InitializeBumps, __reallocs: &mut BTreeSet<Pubkey>, ) -> Result<Self>
Mint account from the SPL token program in a particular
field, then it should be impossible for this method to return Ok if
any other account type is given–from the SPL token program or elsewhere. Read moreSource§impl<'info> AccountsExit<'info> for Initialize<'info>where
'info: 'info,
impl<'info> AccountsExit<'info> for Initialize<'info>where
'info: 'info,
Source§impl<'info> Bumps for Initialize<'info>where
'info: 'info,
impl<'info> Bumps for Initialize<'info>where
'info: 'info,
Source§type Bumps = InitializeBumps
type Bumps = InitializeBumps
Source§impl<'info> ToAccountInfos<'info> for Initialize<'info>where
'info: 'info,
impl<'info> ToAccountInfos<'info> for Initialize<'info>where
'info: 'info,
fn to_account_infos(&self) -> Vec<AccountInfo<'info>>
Source§impl<'info> ToAccountMetas for Initialize<'info>
impl<'info> ToAccountMetas for Initialize<'info>
Source§fn to_account_metas(&self, is_signer: Option<bool>) -> Vec<AccountMeta>
fn to_account_metas(&self, is_signer: Option<bool>) -> Vec<AccountMeta>
is_signer is given as an optional override for the signer meta field.
This covers the edge case when a program-derived-address needs to relay
a transaction from a client to another program but sign the transaction
before the relay. The client cannot mark the field as a signer, and so
we have to override the is_signer meta field given by the client.Auto Trait Implementations§
impl<'info> Freeze for Initialize<'info>
impl<'info> !RefUnwindSafe for Initialize<'info>
impl<'info> !Send for Initialize<'info>
impl<'info> !Sync for Initialize<'info>
impl<'info> Unpin for Initialize<'info>
impl<'info> UnsafeUnpin for Initialize<'info>
impl<'info> !UnwindSafe for Initialize<'info>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more