docs: p-token #138 SyncNative breaking change migration guide - #154
Closed
tracy-codes wants to merge 1 commit into
Closed
docs: p-token #138 SyncNative breaking change migration guide#154tracy-codes wants to merge 1 commit into
tracy-codes wants to merge 1 commit into
Conversation
…wig-ts fix p-token PR #138 added account validation to the SPL Token SyncNative instruction: if a second account exists, it must be the Rent Sysvar. The Swig TypeScript client (swig-ts) was identified as appending an extra account during instruction compaction, which will cause transactions to fail after p-token goes live. This commit adds: - Module-level compatibility notes in compact_instructions.rs and lib.rs - A comprehensive migration guide at docs/PTOKEN_SYNC_NATIVE_MIGRATION.md covering the issue, exact fix, pseudocode for swig-ts, and impact on existing clients. No on-chain program changes are required; the fix is client-side.
tracy-codes
added a commit
to anagrambuild/swig-ts
that referenced
this pull request
May 7, 2026
…bility The p-token PR #138 added account validation to SPL Token SyncNative: if a second account exists, it must be the Rent Sysvar. The Swig TS client was appending an extra account during instruction compaction (via handleUnbalanced after a SystemProgram transfer), causing those transactions to fail after p-token goes live. Changes: - Add sanitizeSyncNative() that truncates SyncNative to exactly 1 account (the wSOL ATA) before compaction - Skip handleUnbalanced extra-account logic for SyncNative instructions - Add unit tests verifying sanitization and transfer+SyncNative combos This is a breaking change required for p-token mainnet readiness. See: anagrambuild/swig-wallet#154
tracy-codes
added a commit
to anagrambuild/swig-ts
that referenced
this pull request
May 7, 2026
…bility The p-token PR #138 added account validation to SPL Token SyncNative: if a second account exists, it must be the Rent Sysvar. The Swig TS client was appending an extra account during instruction compaction (via handleUnbalanced after a SystemProgram transfer), causing those transactions to fail after p-token goes live. Changes: - Add sanitizeSyncNative() that truncates SyncNative to exactly 1 account (the wSOL ATA) before compaction - Skip handleUnbalanced extra-account logic for SyncNative instructions - Add unit tests verifying sanitization and transfer+SyncNative combos This is a breaking change required for p-token mainnet readiness. See: anagrambuild/swig-wallet#154
tracy-codes
added a commit
to anagrambuild/swig-ts
that referenced
this pull request
May 7, 2026
…bility The p-token PR #138 added account validation to SPL Token SyncNative: if a second account exists, it must be the Rent Sysvar. The Swig TS client was appending an extra account during instruction compaction (via handleUnbalanced after a SystemProgram transfer), causing those transactions to fail after p-token goes live. Changes: - Add sanitizeSyncNative() that truncates SyncNative to exactly 1 account (the wSOL ATA) before compaction - Skip handleUnbalanced extra-account logic for SyncNative instructions - Add unit tests verifying sanitization and transfer+SyncNative combos This is a breaking change required for p-token mainnet readiness. See: anagrambuild/swig-wallet#154
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.
Summary
This PR documents the p-token #138 breaking change that affects Swig transactions containing
SyncNativeinstructions, and provides the exact resolution required forswig-ts(and Rust SDK clients) to remain compatible after p-token goes live on mainnet.The Issue
During p-token mainnet readiness checks, the Solana Foundation identified Swig transactions (e.g.,
275HQ...X9xgu) that would fail after p-token deployment.Root cause: p-token PR #138 added account validation to the SPL Token
SyncNativeinstruction processor. Previously, the processor iterated only the first account and silently ignored extras. After #138, if a second account exists, it must be the Rent Sysvar — otherwise the instruction errors.The Swig TypeScript client (
packages/lib/src/instructions/compactInstruction.ts) was found to append an extra account to theSyncNativeinstruction during compaction. Because this extra account is not the Rent Sysvar, those transactions will fail under p-token.How It's Fixed
This PR adds documentation and code comments to the
swig-walletrepo. The actual runtime fix must be applied inswig-ts.Changes in this PR
instructions/src/compact_instructions.rsandinstructions/src/lib.rswarning about p-token Ed/swi 66 implement offchain signing instruction per new srfc #138 account validation.docs/PTOKEN_SYNC_NATIVE_MIGRATION.md— a comprehensive guide covering:swig-tsImpact on Clients Currently Using Swig
Who is affected?
swig-tsclients that wrap SOL and rely on the built-in instruction compaction.SyncNativeinstructions.What happens after p-token goes live?
Any Swig transaction containing a
SyncNativeinstruction with an extra account (that is not the Rent Sysvar) will:Backwards compatibility
SyncNativewere silently ignored. These transactions worked.Exact Changes Required for
swig-tsThe TypeScript client must update
packages/lib/src/instructions/compactInstruction.ts(and any other location constructingSyncNative) to prevent invalid extra accounts.Recommended Fix (Option A)
Before compaction, detect
SyncNativeinstructions and truncate their account list to only the wSOL ATA:Alternative Fix (Option B)
If the Swig client architecture requires the extra account to remain for indexing consistency, ensure the second account is
SYSVAR_RENT_PUBKEY:Rust SDK Considerations
The Rust
compact_instructionsfunction does not add extra accounts—it only deduplicates existing ones. Rust SDK users are unaffected unless they manually constructSyncNativewith extra accounts.If constructing
SyncNativein Rust, follow the same rule: either include only the wSOL ATA, or ensure the second account issolana_program::sysvar::rent::ID.Testing Recommendations
swig-ts: VerifySyncNativeinstructions have exactly 1 account (or 2 where the second is Rent).SyncNativetransactions for account counts.Timeline
swig-tsversion and notify all integrators to upgrade.Coordinated by: Solana Foundation (Edward Chan, Justin Blumenthal, Aaron)
Swig tracking: p-token mainnet readiness checks