-
Notifications
You must be signed in to change notification settings - Fork 23
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
Account type #92
Account type #92
Conversation
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.
In this proposal pub is still used? Is that going away or not.
This is a really good example of entilements and exactly the kind I wanted to se. I can ser the power it gives.
What type will an account we in a prepare statement have? |
@bjartek As described in the "Expose Account Access Through References" section, account values will be only exposed through references, i.e. |
Thanks for putting this together @turbolent! My main concern as of now is how an AuthAccount stored in a struct/resource would be migrated. For instance, hybrid custody will need to store an AuthAccount capability in a resource which helps manage access for a parent to get to a child account. Since we're having to add this to a type definition, current type restrictions on contract upgrades would prevent us from migrating to this a new set of interfaces Any ideas how we can get around that issue? |
@austinkline I clarified in the last commit, 002924e, how a |
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.
Definitely feel great about this improvement!
Adding another thought as I work through some other hybrid custody related items, what happens if someone has already named an interface or struct of theirs |
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! This is both a great improvement to the language and a good demonstrative example of the benefits of entitlements.
One point to consider: not to reopen the bikeshed from #86, but regardless of which part of speech and casing convention we decide upon, we should make sure that they are aligned between these two FLIPs, as these will be the likely extent of the built-in entitlements that Cadence has. Currently this FLIP uses a mix of noun and verb entitlements (we should maybe try to make these more uniform?) while the mutability FLIP uses adjectives.
That would lead to an type-checking error where the A quick cursory search in https://github.com/bluesign/flow-mainnet-contracts shows that there are currently no such types on Mainnet (yet). |
Got it, checking for what's out there was my next question. Sounds like only HybridCustody is an issue (we have an |
The Account type flip found [here](onflow/flips#92) is set to define a new type which will cause a conflict in our own type definitions. AuthAccount is going to be split into a set of interfaces and a concrete called `Account` which we also define. If the flip were to be implemented, that type would brick our own contract due to `Account` being a reserved type/keyword. Since we aren't in mainnet yet, we can rename the type here and avoid the conflict entirely.
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.
I really like this idea!
Being able to remove the #allowAccountLinking
pragma is also a nice side effect 👌
I think the change is good, but i fear the cost of migration here aswell. Is it even possible to do in all cases if we cannot change the type of a field? |
I just realized that we'll also need to rethink Maybe add a type parameter, so any entitled We could also "merge" |
@bjartek we'll likely need to somehow allow code to be upgraded in ways that the checker currently rejects, but are actually safe, e.g. here, the name just changes, the underlying value will still be the same (and is actually not storable) |
BTW, there has been an ongoing discussion about naming of entitlements in another FLIP introducing built-in entitlements: #86 (comment) |
Some issues I ran into while starting the implementation of this FLIP:
|
IMO it makes the most sense to just add the fully entitled type here
This makes sense to me. |
Approved in the Cadence Language Design Meeting 🎉 |
The goal of this proposal is to improve how Cadence provides access to accounts.
The proposed API aims to make account access simpler and safer, by enabling and encouraging the principle of least authority (PoLA) for account access.
This FLIP is based on previous discussion in https://forum.onflow.org/t/super-user-account/4088