-
Notifications
You must be signed in to change notification settings - Fork 137
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
Dictionaries key'd by type are order-dependent #2681
Comments
In general it would be nice to enforce that for any two types |
To fix this, we need to:
|
Thanks for looking into this! Makes sense that a fix would be split into two parts. Is this something that makes more sense to bundle with stable cadence since migrations are already needed? Or it is able to be done at the next spork after encoding is "fixed" (whenever that may be)? |
This would (I believe) be a breaking change, since any existing code that relies on these two type keys being different would have different behavior after we change them to be the same. |
Definitely, yeah. Does how this gets handled change with Entitlements anyway? How is that migration being planned? Maybe this has some overlap |
onflow/flips#95 has the discussion of the entitlements migration |
Fix requires migration as part of Stable Cadence |
@dsainati1 It just occurred to me that authorizations of reference types should also be ordered. Could you please open an issue for this? |
Med effort incl. migration |
Add a test case which stores/loads (lookup) across multiple transactions, so encoding. equality comparison, hash value generation, etc. is tested |
Current Behavior
If I have a dictionary key'd by
Type
, the order of their interface conformance matters:However, if I compare the two types, they are equal:
Expected Behavior
I expect that two types which are equal should match to the same key in a dictionary
If I have a type
&{A, B}
and it is equivalent to&{B, A}
, then my expectation is that a dictionary key'd on types should match regardless of their orderSteps To Reproduce
Run this script on the flow emulator:
Environment
The text was updated successfully, but these errors were encountered: