Skip to content

Conversation

@austbot
Copy link
Contributor

@austbot austbot commented Oct 17, 2025

Overview

This PR adds comprehensive ProgramExec authority support to all instruction interfaces in the Swig SDK, enabling program-based authentication for all wallet operations. ProgramExec allows instructions to be authenticated by verifying that a preceding instruction in the transaction matches a configured program ID and instruction discriminator, rather than requiring a cryptographic signature. This work establishes a foundation for more complex authority types like Zero-Knowledge proofs (ZK), Multi-Party Computation (MPC), and other programmable authentication mechanisms that can leverage the preceding instruction pattern.

Security Model

Trust Assumptions:

The authority that adds a ProgramExec authority to the Swig wallet explicitly trusts the configured program ID and instruction discriminator
This is a delegation of trust: the wallet owner is stating "I trust this specific program and instruction to authenticate operations on my behalf"
Validation Requirements: The ProgramExec authority enforces strict validation:
Program ID Match: The preceding instruction's program ID must exactly match the configured program ID
Discriminator Match: The instruction data must start with the configured instruction prefix/discriminator
Account Ordering: The preceding instruction's first two accounts must be:
Account 0: The Swig config account
Account 1: The Swig wallet address account
Execution Success: The preceding instruction must succeed for the Swig instruction to proceed
If the preceding instruction fails, the entire transaction fails
This ensures the trusted program has validated whatever conditions it checks
Security Implications:
✅ Prevents unauthorized programs from authenticating operations
✅ Prevents instruction replay with different discriminators
✅ Ensures the trusted program is aware of which wallet it's authorizing for
✅ Ties authentication to successful program execution (not just presence)
⚠️ Requires careful configuration - incorrect program ID or discriminator could allow unintended access

Copy link
Contributor

@tracy-codes tracy-codes left a comment

Choose a reason for hiding this comment

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

A couple of comments + change suggestions

@tracy-codes tracy-codes merged commit d470576 into main Jan 3, 2026
3 checks passed
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.

3 participants