Instruction file imported from Ah-Riz/velthoryn (
.cursor/rules/vesting-conventions.mdc). Copyright stays with the author.
Vesting Program Conventions
- Anchor 1.0.0 with
anchor-langandanchor-spl - Program ID:
G6iaigUdi2btFwUc2N65twfxwA8Ew5uKKhKJ5RJa8wvu - All arithmetic uses checked ops (
checked_add,saturating_sub, u128 intermediates) - CEI pattern: mutate state before CPI
- Events emitted after every state mutation
- Test runner:
anchor test(picks up*.spec.ts) - 86 tests pass (87 minus 1 skipped)
- Bankrun tests in
vesting.clock.spec.tsfor precise timestamp manipulation - Grace period:
GRACE_PERIOD_SECS = 604800(7 days), defined inconstants.rs
Known issue (as of Phase 00)
cancel_campaigndoes NOT resetpaused→ pause+cancel exploit- Fix: add
tree.paused = falsein cancel_campaign handler - Defense-in-depth: change pause guard to
require!(!tree.paused || tree.cancelled_at.is_some())