Skip to content

fix: auto-wrap non-composable additionalInstructions in prepareForPer…#204

Open
fichiokaku wants to merge 1 commit into
developfrom
fix/prepare-for-permissions-non-composable-additional
Open

fix: auto-wrap non-composable additionalInstructions in prepareForPer…#204
fichiokaku wants to merge 1 commit into
developfrom
fix/prepare-for-permissions-non-composable-additional

Conversation

@fichiokaku

@fichiokaku fichiokaku commented May 1, 2026

Copy link
Copy Markdown
Contributor

…missions

Since the smart-sessions revamp (#181), prepareInstallSmartSessions emits composable instructions, while additionalInstructions passed in raw { chainId, calls } form (the supported shape in v1.1.x) are non-composable. buildBatch rejects mixed batches with:

"All the instructions must be built with buildComposable in order
to support the runtime time parameters."

Auto-wrap any non-composable resolved instructions as composable rawCalldata instructions when the batch contains composable ones, restoring the v1.1.x calling convention.


PR-Codex overview

This PR focuses on enhancing the prepareForPermissions function by introducing a new utility function, normalizeInstructionComposability, which ensures that all instructions in a batch are composable, thereby improving compatibility with previous versions.

Detailed summary

  • Added normalizeInstructionComposability function to enforce composability of instructions.
  • Updated resolvedInstructions to use normalizeInstructionComposability.
  • Implemented logic to wrap non-composable instructions as composable rawCalldata instructions.
  • Added comments for clarity on handling native-token transfers and composability.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

…missions

Since the smart-sessions revamp (#181), `prepareInstallSmartSessions`
emits composable instructions, while `additionalInstructions` passed
in raw `{ chainId, calls }` form (the supported shape in v1.1.x) are
non-composable. `buildBatch` rejects mixed batches with:

  "All the instructions must be built with buildComposable in order
   to support the runtime time parameters."

Auto-wrap any non-composable resolved instructions as composable
`rawCalldata` instructions when the batch contains composable ones,
restoring the v1.1.x calling convention.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@fichiokaku fichiokaku requested a review from vr16x May 1, 2026 08:58
@github-actions

github-actions Bot commented May 1, 2026

Copy link
Copy Markdown

size-limit report 📦

Path Size
core (esm) 71.6 KB (+0.24% 🔺)
core (cjs) 86.66 KB (+0.18% 🔺)
bundler (tree-shaking) 7 KB (0%)
paymaster (tree-shaking) 543 B (0%)

@vr16x

vr16x commented May 1, 2026

Copy link
Copy Markdown
Collaborator

Hey @fichiokaku

Good catch on this, but why not change the calls directly from AbstractCall[] to ComposableCall[]?

So any additional calls must be composable, and this is a strict type-safe behaviour rather than runtime conversions. There is no scope for having a non-composable call here, given the recent change. So this conversion is unnecessary

@vr16x vr16x left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haven't reviewed the code, but suggested a high level directional change

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.

2 participants