Security Model
The Zero-CPI verification pattern relies on multiple layers of validation. This page documents each security guarantee and how it prevents specific attack vectors.
Security Guarantees
| Property | Mechanism | Attack Prevented |
|---|---|---|
| Owner verification | flash_state.owner == VAEA_PROGRAM_ID | Forged PDA from another program |
| PDA derivation | Seeds validated: ["flash", payer, token_mint] | Cross-user or cross-token collision |
| Instruction introspection | Sysvar scan for begin_flash before + end_flash after | Standalone call without active loan |
| Slot freshness | slot_created checked against current slot | Replaying a PDA from a prior transaction |
| Atomicity | If end_flash fails โ entire TX reverts | Partial execution / fund extraction |
| Non-custodial | Tokens flow: protocol โ user โ protocol | VAEA holding user funds |
Can the FlashState PDA Be Forged?
No. On Solana, only a program can modify accounts it owns. The FlashState PDA is owned by the VAEA program (HoYiwkNB7a3gmZXEkTqLkborNDc976vKEUAzBm8YpK5E). A malicious program cannot:
โข Create an account owned by the VAEA program โ only VAEA can do that
โข Modify an existing FlashState's data โ only the owner can write
โข Set its own program as the owner and fool verify() โ the owner check rejects it
Can a FlashState Be Replayed?
No. The FlashState PDA is created by begin_flash and closed by end_flash in the same transaction. After the transaction, the account no longer exists. Even if it could persist:
โข The slot_created field would not match the current slot
โข The instruction introspection would not find begin_flash / end_flash in the current TX
โข Both checks must pass โ either one prevents replay
Instruction Introspection
verify() uses the instructions sysvar (Sysvar1nstructions1111111111111111111111111) to scan the current transaction's instruction list. It verifies:
CPI Depth Comparison
The key advantage of CTX over CPI-based verification:
| Scenario | With CPI Verification | With VAEA CTX |
|---|---|---|
| Protocol โ token_program | 2 levels โ | 1 level โ |
| Protocol โ Jupiter โ AMM โ token | 4 levels โ ๏ธ | 3 levels โ |
| Proto_A โ Proto_B โ Jupiter โ AMM | 5 levels โ | 4 levels โ |
Program Immutability
Post-mainnet, the VAEA on-chain program will have no upgrade authority. Properties:
โข No admin key โ nobody can pause or modify the program
โข No upgrade authority โ the bytecode is frozen
โข No fee changes โ the 2 bps rate is hardcoded in the config PDA
โข Fully permissionless โ anyone can use it, no registration needed
verify() flow is fully decentralized โ it reads on-chain data only, with no dependency on VAEA servers.