In the InitializePool instruction, the lp_mint account is being initialized with seeds that include the liquidity_pool key. However, the liquidity_pool account itself is also being initialized in the same instruction after lp_mint. Since liquidity_pool is not yet created and assigned a key at the time lp_mint is initialized, using its key as a seed causes the lp_mint account initialization to fail.
Additionally, Anchor validates and reads accounts sequentially in the order they are declared in the accounts struct — from top to bottom. Since lp_mint appears before liquidity_pool in the accounts struct, Anchor attempts to initialize lp_mint before liquidity_pool is available, causing the seed derivation to break.
Because lp_mint initialization depends on the yet-to-be-created liquidity_pool account, the program will fail during account creation, causing the entire transaction to revert. This breaks pool initialization and prevents the protocol from creating new liquidity pools successfully.
Reorder the accounts in the struct so that liquidity_pool is declared before lp_mint. This ensures the liquidity_pool account is initialized and its key available before lp_mint initialization runs. Example:
This adjustment respects Anchor’s sequential account initialization and fixes the seed derivation issue.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.