Skip to content

verification issue #3

@mrsirg97-rgb

Description

@mrsirg97-rgb

Bug 2: said-sdk verify has incorrect account ordering

Problem

The said-sdk npm package buildVerifyInstruction function passes accounts in the wrong order, causing AccountOwnedByWrongProgram error.

Current (incorrect) account order in SDK:

// In said-sdk/dist/chunk-6MFDE2R7.mjs
buildVerifyInstruction(agentPDA, owner) {
  return new TransactionInstruction({
    keys: [
      { pubkey: agentPDA, isSigner: false, isWritable: true },
      { pubkey: owner, isSigner: true, isWritable: true },        // WRONG POSITION
      { pubkey: TREASURY_PDA, isSigner: false, isWritable: true }, // WRONG POSITION
      { pubkey: SystemProgram.programId, isSigner: false, isWritable: false }
    ],
    ...
  });
}

Correct account order (per program):

// From programs/said/src/lib.rs
#[derive(Accounts)]
pub struct GetVerified<'info> {
    pub agent_identity: Account<'info, AgentIdentity>,  // 1. agent
    pub treasury: Account<'info, Treasury>,              // 2. treasury
    pub owner: Signer<'info>,                            // 3. owner
    pub system_program: Program<'info, System>,          // 4. system
}

Fix

Swap accounts 2 and 3:

buildVerifyInstruction(agentPDA, owner) {
  return new TransactionInstruction({
    keys: [
      { pubkey: agentPDA, isSigner: false, isWritable: true },
      { pubkey: TREASURY_PDA, isSigner: false, isWritable: true }, // treasury second
      { pubkey: owner, isSigner: true, isWritable: true },          // owner third
      { pubkey: SystemProgram.programId, isSigner: false, isWritable: false }
    ],
    ...
  });
}

Verification

After fixing, successfully verified Torch Market:

  • Tx: 54aYJBsApNY1KkEGixyz4SLLoRbYn2p8EVy6cnb7En4tAqHyV4QFJ9xGULAiTv4g986EMEbYQ3KBvFHUbngW7Gj4
  • Status: ✅ Verified

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