bmresearch / Solnet

Solana's .NET SDK and integration library.
https://blockmountain.io/Solnet
MIT License
324 stars 130 forks source link

[Bug] InstructionDecoder.DecodeInstructions thrown a KeyNotFoundException exception #371

Closed nazbrok closed 2 years ago

nazbrok commented 2 years ago

Describe the bug

The Helper Solnet.Programs.InstructionDecoder.DecodeInstructions is throwing an error : KeyNotFoundException: The given key '18' was not present in the dictionary

System.Collections.Generic.KeyNotFoundException: The given key '18' was not present in the dictionary.
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at Solnet.Programs.TokenProgram.Decode(ReadOnlySpan`1 data, IList`1 keys, Byte[] keyIndices)
   at Solnet.Programs.InstructionDecoder.DecodeInstructions(TransactionMetaInfo txMetaInfo)

All was working perfectly since yesterday around 20 PM UTC

To Reproduce Decoding this instruction (on mainnet) throw the exception above : 3Mhp6cAfmzmztNKPFR1nJJYuhH1FNnKfDpCN5VM6YJnHsqkMCxqCx7VrBwvXPKRXVVS5MLX5mPaWgjPQXM8kHNM4

Expected behavior Decode the transaction without errors

Screenshots

Desktop (please complete the following information): Tested on Node version 1.9.13 (quicknode) and 1.9.16 (public beta solana) Add the issue on Solnet 6.0.4, I upgraded to latest version 6.0.7 and the issue is still there

nazbrok commented 2 years ago

Note : The transactions failing to decode are ALL the transaction from marketplace MagicEden when someone buy an item. The transaction of someone putting his item for sale are correctly decoded.

tiago18c commented 2 years ago

Quick analysis: new instructions were added to the program that the library doesn't yet handle. should be a quick fix later today.