Skip to content
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

Allow adding fields to contracts #1540

Open
turbolent opened this issue Mar 28, 2022 · 1 comment
Open

Allow adding fields to contracts #1540

turbolent opened this issue Mar 28, 2022 · 1 comment

Comments

@turbolent
Copy link
Member

turbolent commented Mar 28, 2022

Issue To Be Solved

Declaring new composite fields is currently unsupported for all kinds of composites (resources, structs, contracts).

Currently, contracts are implemented as composite values, just like resources and structs, i.e. each contract variable is a field in the composite value.

When declaring a new field for a composite, we need to migrate all already existing composite values and add the new field, which might be prohibitively expensive for some composite declarations, like resources and structs of popular contracts (e.g. there are millions of TopShot Moment resources stored).

However, given that contract values are singletons, we could actually allow adding fields to contracts, as only one single value is stored and needs to be migrated.

Suggested Solution

  • Allow adding fields to contracts
  • Load the existing contract value and add the new field
@j1010001
Copy link
Member

j1010001 commented Oct 19, 2022

Might get more generally solved by FLIP onflow/flow#1097

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants