Skip to content

Allow adding fields to contracts #1540

Description

@turbolent

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions