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 state shape with new optional fields #10200

Open
mhofman opened this issue Oct 2, 2024 · 0 comments
Open

Allow state shape with new optional fields #10200

mhofman opened this issue Oct 2, 2024 · 0 comments
Labels
contract-upgrade enhancement New feature or request liveslots requires vat-upgrade to deploy changes SwingSet package: SwingSet

Comments

@mhofman
Copy link
Member

mhofman commented Oct 2, 2024

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

@mhofman mhofman added enhancement New feature or request SwingSet package: SwingSet contract-upgrade liveslots requires vat-upgrade to deploy changes labels Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contract-upgrade enhancement New feature or request liveslots requires vat-upgrade to deploy changes SwingSet package: SwingSet
Projects
None yet
Development

No branches or pull requests

1 participant