Skip to content

Make callback attachment and fee charging atomic #1907

Description

@bmuddha

Scope

AddActionCallback charges 5,000 lamports before validating the scheduled intent and callback. A later error can therefore leave a fee transfer without attaching a callback if a native caller catches the CPI error and returns success.

Observed at Validator v2.0.0-rc.2 (377a086af0cffd72cb24a19ee94bafadbc4ed25a), with Engine b3b3d15163f8d219255605126c5c92aba30121dd:

A local native-CPI reproduction caught InvalidAccountData from an empty context and returned outer success. One/two calls transferred 5,000/10,000 lamports to the protocol vault while the context stayed unchanged and no callback was scheduled.

Treat this as an unlikely correctness issue / technical debt, not an established deployed attack path. The reproduction requires the payer signature and delegated payer/vault accounts, and uses a test-only native caller. No deployed SBF caller or production exploit was demonstrated; the recipient is the protocol vault.

Outcome

Failed callback attachment leaves both the context and fee balances unchanged; successful attachment charges exactly once. Complete validation and fallible preparation before publishing account changes, including serialization/capacity checks and both fee-balance calculations. Moving the charge below validation alone still leaves serialization failures after the charge.

Activity

  1. added theissue type on Nov 9, 2026
  2. added
    techdebtIssues outlining shortcuts we took that need to be fixed when we have time
    on Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

techdebtIssues outlining shortcuts we took that need to be fixed when we have time

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions