Allow state shape with new optional fields #10200
Labels
contract-upgrade
enhancement
New feature or request
liveslots
requires vat-upgrade to deploy changes
SwingSet
package: SwingSet
What is the Problem Being Solved?
Exo/kinds using stateShape cannot change their shape when upgrading. #7407 describes a way to do schema migration, but a simpler approach is possible for state shapes that are "compatible" as described in #7407 (comment): existing fields must retain identical shapes (including exact identity of any remotable reference), and new fields are allowed only if they're optional (allow undefined values)
Description of the Design
when liveslots checks the compatibility of the state shape, iterate over fields of the shape, assert that any previously existing fields are the same pattern, and that any new field accepts the
undefined
value.When reading state data from the vatStore, accept a missing entry as an
undefined
value.When writing state data, handle a previously missing entry. Consider "deleting" the prop's entry if the value is
undefined
(cheap compression)Security Considerations
None
Scaling Considerations
None
Test Plan
Some fake liveslots based test which triggers kind redefinition logic.
Upgrade Considerations
Requires a new liveslots, and thus a chain software upgrade
The text was updated successfully, but these errors were encountered: