fix(audit): lock header v1 layout (MULT-4)#31
Merged
dev-jodee merged 10 commits intoApr 28, 2026
Merged
Conversation
Compute Unit Report
Generated: 2026-04-28 |
3ddc3cb to
6155c84
Compare
76ac33e to
6ecb3eb
Compare
6155c84 to
40be1d2
Compare
6ecb3eb to
c2a2733
Compare
- Compile-time assertions for Header::LEN, header field offsets, and FixedDelegation / RecurringDelegation / SubscriptionDelegation LEN - Document release-gate in docs/003: future layout changes must bump CURRENT_VERSION and ship a migrate IX - Annotate CURRENT_VERSION with the v1 lock note CURRENT_VERSION stays at 1.
c2a2733 to
18f489c
Compare
2 tasks
- PLAN_LEN_V1 + assert in plan.rs - PLAN_DATA_LEN_V1 + assert in create_plan.rs
Skip rollover when candidate_start >= expiry_ts. Pulls within drift window remain valid in the final authorized period; no fresh allowance is granted in terminal periods. Affects validate_recurring_transfer (used by recurring delegations and subscription transfers).
Extract is_effectively_expired helper. Sponsor revocation now waits the same TIME_DRIFT_ALLOWED_SECS past expiry that transfers tolerate, so sponsor cannot close a delegation while the delegatee can still pull.
Extend SubscribeData with expected_mint/amount/period_hours/created_at. Program rejects with PlanTermsMismatch if the live plan disagrees with what the subscriber signed. Stale-signed subscribe transactions can no longer enroll into a recreated plan with different terms. SDK and webapp callers fetch plan data and pass the snapshot.
Plan::check_destination and Plan::can_pull now filter out zero-padded slots before membership tests. A plan with fewer than four configured destinations no longer authorizes a zero-owned receiver, and a plan with fewer than four pullers no longer authorizes a zero-pubkey caller.
…-10) Webapp exit flows now pass the on-chain payer as receiver when it differs from the connected signer, so sponsor-funded delegations and SubscriptionAuthority accounts can actually be closed. Also migrates revokeSubscription and cancelAndRevokeSubscription from buildRevokeDelegation to buildRevokeSubscription with planPda + receiver, fixing subscription revoke for both sponsor and non-sponsor cases.
…(MULT-9) Stale-delegation cleanup no longer appends a close on the current SubscriptionAuthority. Revoking stale delegations is now scoped to the supplied delegation accounts; the SA stays open and current grants remain valid.
8fe83b6
into
audit/ai-scanner/01-rotate-program-keypair
4 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Audit finding: MULT-4
Lock the current delegation
Headerlayout as the canonical v1 baseline and gate future growth.Changes
assert!forHeader::LEN == 107and every header offset (DISCRIMINATOR_OFFSET,VERSION_OFFSET,BUMP_OFFSET,DELEGATOR_OFFSET,DELEGATEE_OFFSET,PAYER_OFFSET,INIT_ID_OFFSET)assert!forFixedDelegation::LEN == 123,RecurringDelegation::LEN == 147,SubscriptionDelegation::LEN == 155docs/003-versioning-migration-architecture.mddocumenting the release-gate: any future layout change MUST bumpCURRENT_VERSIONand ship a v1 -> v2 migrateCURRENT_VERSIONdoc-comment updated to reference the lock + release-gateCURRENT_VERSIONstays at1. No migration code added.Test plan
cargo build -p subscriptions(compile-time assertions enforced)cargo test -p subscriptions --lib(210/210 pass)cargo buildwith the asserted error messageStack
Stacked on top of #30 (MULT-19).