Skip to content

bug with cli #2

@mrsirg97-rgb

Description

@mrsirg97-rgb

Bug: said-register CLI has incorrect instruction discriminator

Problem

The said-register npm package (v1.1.0) fails with InstructionFallbackNotFound error because it uses an incorrect Anchor instruction discriminator.

Current (incorrect) discriminator in CLI:

const REGISTER_DISCRIMINATOR = Buffer.from([24, 148, 140, 128, 250, 165, 176, 165]);

Correct discriminator:

// sha256("global:register_agent")[0:8]
const REGISTER_DISCRIMINATOR = Buffer.from([135, 157, 66, 195, 2, 113, 175, 30]);

Fix

In bin/register.mjs, replace the hardcoded discriminator with:

import crypto from 'crypto';

// Correct Anchor discriminator: sha256("global:register_agent")[0:8]
const REGISTER_DISCRIMINATOR = crypto.createHash('sha256')
  .update('global:register_agent')
  .digest()
  .slice(0, 8);

Or just update the hardcoded value to: [135, 157, 66, 195, 2, 113, 175, 30]

Verification

After fixing, successfully registered Torch Market:

  • Tx: t71mMUAJCS1HNPUwveidrP38ateUUxmKPkTQnWe5UjMAY8o2jtE9PAYAn55SRw7SjomdGvmbAagAkmnxz9d616a
  • Agent PDA: 2rNknLxB7nWYJRgr2tZrNoc7PNDy3PKwKZa9YStbLMmb

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