From b12e10934d89add2ca7377a482179570bb4031bc Mon Sep 17 00:00:00 2001 From: jeffyanta Date: Mon, 2 Feb 2026 10:20:19 -0500 Subject: [PATCH 1/2] Remove blockchain account check for VM swap ATAs in SubmitIntent --- ocp/rpc/transaction/intent_handler.go | 37 +++++++++++++++------------ 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/ocp/rpc/transaction/intent_handler.go b/ocp/rpc/transaction/intent_handler.go index 7b840ba..100e2fd 100644 --- a/ocp/rpc/transaction/intent_handler.go +++ b/ocp/rpc/transaction/intent_handler.go @@ -810,22 +810,27 @@ func (h *SendPublicPaymentIntentHandler) validateActions( } // Check whether the destination account is a token account of the same mint that's - // been created on the blockchain. If not, a fee is likely required - err = validateExternalTokenAccountWithinIntent(ctx, h.data, destination, intentMint) - switch err { - case nil: - default: - if !strings.Contains(strings.ToLower(err.Error()), "doesn't exist on the blockchain") { - return err - } - - if metadata.DestinationOwner == nil { - return NewIntentValidationError("destination owner account is required to derive ata") - } - - // Only VM swap PDAs are subsidized by server - if !simResult.HasAnyFeePayments() && !isVmSwapPda { - return NewIntentValidationErrorf("%s fee payment is required", transactionpb.FeePaymentAction_CREATE_ON_SEND_WITHDRAWAL.String()) + // been created on the blockchain. If not, a fee is likely required. + // + // Note: We can skip these checks for VM swap ATAs because the account is already + // validated, and no fee payment is required. + if !isVmSwapPda { + err = validateExternalTokenAccountWithinIntent(ctx, h.data, destination, intentMint) + switch err { + case nil: + default: + if !strings.Contains(strings.ToLower(err.Error()), "doesn't exist on the blockchain") { + return err + } + + if metadata.DestinationOwner == nil { + return NewIntentValidationError("destination owner account is required to derive ata") + } + + // Only VM swap PDAs are subsidized by server + if !simResult.HasAnyFeePayments() && !isVmSwapPda { + return NewIntentValidationErrorf("%s fee payment is required", transactionpb.FeePaymentAction_CREATE_ON_SEND_WITHDRAWAL.String()) + } } } From 454272e23e4d8492248e75677b3f3938f58835b3 Mon Sep 17 00:00:00 2001 From: jeffyanta Date: Mon, 2 Feb 2026 10:21:25 -0500 Subject: [PATCH 2/2] More clear variable and comments --- ocp/rpc/transaction/intent_handler.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ocp/rpc/transaction/intent_handler.go b/ocp/rpc/transaction/intent_handler.go index 100e2fd..3790470 100644 --- a/ocp/rpc/transaction/intent_handler.go +++ b/ocp/rpc/transaction/intent_handler.go @@ -779,7 +779,7 @@ func (h *SendPublicPaymentIntentHandler) validateActions( // Ensure the destination is the intent mint ATA for the client-provided owner, // if provided. We'll check later if this is absolutely required. - var isVmSwapPda bool + var isDestinationOwnerVmSwapPda bool if metadata.DestinationOwner != nil { destinationOwner, err := common.NewAccountFromProto(metadata.DestinationOwner) if err != nil { @@ -797,7 +797,7 @@ func (h *SendPublicPaymentIntentHandler) validateActions( _, err = h.data.GetTimelockBySwapPda(ctx, destinationOwner.PublicKey().ToBase58()) if err == nil { - isVmSwapPda = true + isDestinationOwnerVmSwapPda = true } else if err != timelock.ErrTimelockNotFound { return err } @@ -814,7 +814,7 @@ func (h *SendPublicPaymentIntentHandler) validateActions( // // Note: We can skip these checks for VM swap ATAs because the account is already // validated, and no fee payment is required. - if !isVmSwapPda { + if !isDestinationOwnerVmSwapPda { err = validateExternalTokenAccountWithinIntent(ctx, h.data, destination, intentMint) switch err { case nil: @@ -827,8 +827,8 @@ func (h *SendPublicPaymentIntentHandler) validateActions( return NewIntentValidationError("destination owner account is required to derive ata") } - // Only VM swap PDAs are subsidized by server - if !simResult.HasAnyFeePayments() && !isVmSwapPda { + // Only VM swap ATAs are subsidized by server + if !simResult.HasAnyFeePayments() && !isDestinationOwnerVmSwapPda { return NewIntentValidationErrorf("%s fee payment is required", transactionpb.FeePaymentAction_CREATE_ON_SEND_WITHDRAWAL.String()) } }