solanaInstructionDecoder was built with a discriminator set it can’t use: an instruction with no
discriminator or with more than one, discriminators of mixed widths across the decoder
(d1/d2/d4/d8), or two instructions sharing a discriminator. A decoder covers a single
program/ABI — one width, distinct discriminators — because Anchor discriminators are
program-independent, so a shared one would decode the same raw instruction under both keys.
Fix — give each instruction exactly one discriminator, keep a single width per decoder, and split
unrelated programs into separate solanaInstructionDecoder() calls. If the mixed widths really do
belong to one program — an ABI whose extension instructions carry a wider discriminator than its base
ones — split it by width instead: one decoder per width, the same programId.
Wrong — two different programs in one decoder. Their swap instructions are unrelated, but Anchor
derives both discriminators from sha256("global:swap"), so they collide and each would decode the
other’s data:
transfer is identical on both: