-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Map keys should be sorted alphabetically as Rust expects #141
Comments
@willemneal is this something you can incorporate (or needs to be incorporated?) into |
Good question, I need to look at how the ContractSpec handle's maps, but I think it should be done there. |
I'm not sure this is the responsibility of the contract spec. The contract spec doesn't have an opinion on how the Map val is ordered. It presents the fields in the order of code such that they can be regenerated in the same order. Also, Maps are used irrespective of a contract type, and so the JS lib and every SDK needs to be able to support sorting a maps entries so they're valid. Map keys may be numbers, symbols, strings, bytes, anything really. |
When an argument is or contains a Map Rust expects the keys to be alphabetically ordered but JS doesn't enforce that. This will cause unclear errors right now. Soroban client likely should perform a key sort behind the scenes in order to avoid this issue.
The text was updated successfully, but these errors were encountered: