From c44c4c492e2fd5bd56fcb4523ce5497b7ba453ac Mon Sep 17 00:00:00 2001 From: pwsaragossy <148293189+pwsaragossy@users.noreply.github.com> Date: Mon, 24 Aug 2026 21:32:11 -0300 Subject: [PATCH 1/2] docs: note that Execute.amount is u64::MAX for confidential transfers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The doc on `TransferHookInstruction::Execute.amount` reads "Amount of tokens to transfer". On the confidential-transfer path Token-2022 passes `u64::MAX` instead, because the amount is encrypted and unavailable to the program. The convention is deliberate and commented at the call site, but nothing on the receiving side records it — `u64::MAX` appears nowhere in this repository. A hook implementing amount-based policy reads this field's documentation and has no reason to expect a sentinel. --- interface/src/instruction.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/interface/src/instruction.rs b/interface/src/instruction.rs index 7263768..546aa8a 100644 --- a/interface/src/instruction.rs +++ b/interface/src/instruction.rs @@ -28,7 +28,14 @@ pub enum TransferHookInstruction { /// 5. ..`5+M` `[]` `M` optional additional accounts, written in /// validation account data Execute { - /// Amount of tokens to transfer + /// Amount of tokens to transfer. + /// + /// When Token-2022 invokes a hook from a confidential transfer, the + /// amount is not known to the token program and `u64::MAX` is passed + /// as a convention. A hook that enforces amount-based policy must + /// handle this sentinel explicitly: compared directly it makes a + /// per-transfer cap reject every confidential transfer, and added to + /// a running total it wraps. amount: u64, }, From 504699380b706eaf846d51235d79e97c4d1eb828 Mon Sep 17 00:00:00 2001 From: Jon C Date: Thu, 3 Sep 2026 13:20:53 +0200 Subject: [PATCH 2/2] Apply suggestion from @joncinque --- interface/src/instruction.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/interface/src/instruction.rs b/interface/src/instruction.rs index 546aa8a..2a0f1a8 100644 --- a/interface/src/instruction.rs +++ b/interface/src/instruction.rs @@ -33,9 +33,7 @@ pub enum TransferHookInstruction { /// When Token-2022 invokes a hook from a confidential transfer, the /// amount is not known to the token program and `u64::MAX` is passed /// as a convention. A hook that enforces amount-based policy must - /// handle this sentinel explicitly: compared directly it makes a - /// per-transfer cap reject every confidential transfer, and added to - /// a running total it wraps. + /// handle this sentinel explicitly. amount: u64, },