-
Notifications
You must be signed in to change notification settings - Fork 138
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
Don't short circuit references on member access when entitlements are involved #3387
Conversation
Cadence Benchstat comparisonThis branch with compared with the base branch onflow:master commit 499c877 Collapsed results for better readability
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The description specifically refers to structs. Is this only a problem for structs and the problem does not exist / is already handled for resources?
Yes, because references are not a subtype of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
Closes https://github.com/dapperlabs/cadence-internal/issues/234
When a struct-typed field is accessed on a reference to a composite, we return a reference to that struct instead of the actual struct itself. However, when the struct-typed field has type
AnyStruct
and the underlying value of that field is itself a reference, we don't create a doubly nested reference, instead just returning the underlying value directly. This is normally fine, but when the type being created has entitlements (usually as the result of a mapping) this can cause entitlements to be granted to the resulting reference that it shouldn't have. This disables this short circuiting when if the reference type being created should be entitled.Thanks to @bluesign for the report
master
branchFiles changed
in the Github PR explorer