Skip to content

fix(lang-v2): allow handlers to opt out of wrapper inlining - #4959

Open
abhineet-biju wants to merge 2 commits into
otter-sec:anchor-nextfrom
abhineet-biju:fix/v2-dispatch-stack-frame
Open

fix(lang-v2): allow handlers to opt out of wrapper inlining#4959
abhineet-biju wants to merge 2 commits into
otter-sec:anchor-nextfrom
abhineet-biju:fix/v2-dispatch-stack-frame

Conversation

@abhineet-biju

Copy link
Copy Markdown

Summary

  • add an opt-in #[handler(inline = false)] policy for generated instruction wrappers
  • preserve the existing #[inline(always)] default
  • add validation for malformed handler options
  • document the stack-frame isolation syntax and performance tradeoff
  • add an SBF regression that reproduces the dispatcher overflow before verifying the fix

The regression uses platform-tools v1.52. The forced-inline build reproduces
the oversized __anchor_dispatch_internal frame, while isolated wrappers stay
within the 4096-byte SBF stack-frame limit.

Fixes #4941.

Branch Target

This is a v2-only change and targets anchor-next.

Testing

  • cargo test --locked -p anchor-derive-accounts
  • cargo test --locked -p anchor-lang --tests
  • cargo test --locked -p tests-v2 --test handler_inline_policy
  • cargo test --locked -p tests-v2 --tests --no-run
  • cargo check --locked -p handler-inline-policy --all-targets --all-features

- add a per-handler inline policy while preserving the existing default
- cover parsing behavior and the SBF dispatcher stack overflow regression
- document the opt-in syntax and performance tradeoff
@vercel

vercel Bot commented Aug 22, 2026

Copy link
Copy Markdown

@abhineet-biju is attempting to deploy a commit to the OtterSec Team on Vercel.

A member of the Team first needs to authorize it.

@abhineet-biju
abhineet-biju marked this pull request as ready for review August 26, 2026 07:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant