Skip to content

L-1: Post-#105 dead weight: portfolio/nft_pda still marked writable in transfer-hook extra-metas #161

Description

@v1ktorrr0x

Bug

PR #105 (escrow-at-mint) removed the B-3 ownership CPI from the transfer hook. process_execute is now validation-only and performs no writes. Yet:

  • ExtraAccountMetaList still declares entry 5 (PositionNft PDA) and entry 6 (Portfolio) as writable (processor.rs:655-658)
  • RepairExtraMetas docs (instruction.rs:119-124) justify its existence entirely by: "the transfer hook CPIs into percolator-prog with TransferPortfolioOwnership (tag 72), which mutates owner… Without portfolio writable, the CPI fails."

That CPI no longer exists in the hook.

Source Impact

Not exploitable — the hook can't write the portfolio during a Token-2022 CPI anyway. But every NFT transfer now takes an unnecessary write-lock on the shared portfolio account, serializing against other portfolio transactions based on an obsolete requirement.

Fix

  1. Flip entries 5 and 6 in build_extra_account_metas / RepairExtraMetas to read-only
  2. Verify the wrapper no longer needs them writable for B-3 (which under escrow it shouldn't at transfer time)
  3. Rewrite the RepairExtraMetas rationale to reflect Design: minting does not escrow the position — minter retains direct control until first NFT transfer (contradicts documented custody) #105's custody model

Labels: cleanup, performance

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions