-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
Summary
Detect mismatched bump usage, endianness inconsistencies, and unsafe account allocation/reallocation/closure patterns.
Related to #3
Why it matters
• A mismatched bump between derive and constraint can cause unexpected PDA resolution failures.
• Wrong endianness can corrupt account layouts.
• Unsafe init, realloc, or close can leak lamports, break rent-exemption, or cause logic errors.
Proposed Approach
• Compare bumps from find_program_address with bumps declared in account attributes.
• Track numeric serialization patterns and warn on big/little-endian mismatches.
• On init/realloc/close, check:
• Rent-exemption math correctness
• Zero-initialization on growth
• No unchecked shrinking without data reset
• Correct space calculation
Examples
Flag:
let (pda, bump0) = Pubkey::find_program_address(...);
#[account(seeds=[...], bump = bump1)] // bump1 != bump0
pub acct: Account<'info, Foo>;Metadata
Metadata
Assignees
Labels
No labels