WalletConnect/WalletConnectSharp

Potential chain selection issue related to Dictionary keys order

Antivortex opened this issue · 1 comments

Hello!

This piece of code in the Engine.cs Request method implies that the keys are determenistically ordered in the dictionary and will keep same order in the array generated by ToArray() call.

var firstRequiredNamespace = sessionData.RequiredNamespaces.Keys.ToArray()[0]; defaultChainId = sessionData.RequiredNamespaces[firstRequiredNamespace].Chains[0];

However the keys order is non-determenistic in the C# dictionary and might depend on implementation. You can see more details here:

https://stackoverflow.com/questions/4007782/the-order-of-elements-in-dictionary

Fixed in #156