From 1d19d85555370119bb4588b3b12a0b44cfd4d034 Mon Sep 17 00:00:00 2001 From: Jon C Date: Fri, 27 Feb 2026 23:39:11 +0100 Subject: [PATCH] p-token: Allow for token-2022 to be used #### Problem This is the p-token version of https://github.com/solana-program/token-2022/pull/1005, which resolves https://github.com/solana-program/token-2022/issues/997, but in p-token. P-token and token-2022 should respect each other's multisigs. #### Summary of changes Relax the multisig ownership check to also allow for token-2022 to own the multisig account. --- Cargo.lock | 1 + pinocchio/program/Cargo.toml | 1 + pinocchio/program/src/processor/mod.rs | 8 +++++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 3f58be13..73ef4d92 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3266,6 +3266,7 @@ dependencies = [ "num-traits", "pinocchio", "pinocchio-log", + "pinocchio-pubkey", "pinocchio-token-interface", "solana-account", "solana-instruction", diff --git a/pinocchio/program/Cargo.toml b/pinocchio/program/Cargo.toml index 974bedd6..c9eea7e5 100644 --- a/pinocchio/program/Cargo.toml +++ b/pinocchio/program/Cargo.toml @@ -17,6 +17,7 @@ logging = [] [dependencies] pinocchio = { workspace = true } pinocchio-log = { version = "0.5.1", default-features = false } +pinocchio-pubkey = "0.3" pinocchio-token-interface = { version = "^0", path = "../interface" } [dev-dependencies] diff --git a/pinocchio/program/src/processor/mod.rs b/pinocchio/program/src/processor/mod.rs index 07cb8985..ff0ab7bb 100644 --- a/pinocchio/program/src/processor/mod.rs +++ b/pinocchio/program/src/processor/mod.rs @@ -73,6 +73,11 @@ pub use { /// Number of bytes in a `u64`. const U64_BYTES: usize = core::mem::size_of::(); +/// Token-2022 program id, to allow for its multisigs to be used in p-token +mod spl_token_2022 { + pinocchio_pubkey::declare_id!("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"); +} + /// Maximum number of digits in a formatted `u64`. /// /// The maximum number of digits is equal to the maximum number @@ -111,7 +116,8 @@ unsafe fn validate_owner( if unlikely( owner_account_info.data_len() == Multisig::LEN - && owner_account_info.is_owned_by(&TOKEN_PROGRAM_ID), + && (owner_account_info.is_owned_by(&TOKEN_PROGRAM_ID) + || owner_account_info.is_owned_by(&spl_token_2022::ID)), ) { // SAFETY: the caller guarantees that there are no mutable borrows of // `owner_account_info` account data and the `load` validates that the