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

contract upgrade #968

Merged
merged 2 commits into from
Feb 17, 2024
Merged

contract upgrade #968

merged 2 commits into from
Feb 17, 2024

Conversation

dckc
Copy link
Member

@dckc dckc commented Feb 8, 2024

goal:
fixes #750

rendered:

Audience is dapp/contract devs, so the emphasis is on how to achieve it, not the theory of how the infrastructure works. @LuqiPan , @kbennett2000 I'm particularly interested to know if this brief account covers the subject well enough for you to get a working knowledge of it.

It lacks detail on interface guards. I propose to merge this as is and add those later. Opinions?

I started trying to make sure all the code snippets are really tested, but makeZoeKitForTest doesn't support upgrade, and it's not clear to me how to do bootstrap tests with makeSwingsetTestKit from outside agoric-sdk; I have already spent probably too much time on tooling in #965.

Testing considerations

Examples are not well tested due to the difficulty of landing...

Copy link

cloudflare-workers-and-pages bot commented Feb 8, 2024

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: dad0201
Status: ✅  Deploy successful!
Preview URL: https://02226528.documentation-7tp.pages.dev
Branch Preview URL: https://dc-durable-upgrade.documentation-7tp.pages.dev

View logs

@dckc dckc force-pushed the dc-durable-upgrade branch from 17f858a to 3417f5a Compare February 8, 2024 10:04
main/guides/zoe/contract-upgrade.md Outdated Show resolved Hide resolved
main/guides/zoe/contract-upgrade.md Outdated Show resolved Hide resolved
main/guides/zoe/contract-upgrade.md Outdated Show resolved Hide resolved
main/guides/zoe/contract-upgrade.md Show resolved Hide resolved
@dckc dckc force-pushed the dc-durable-upgrade branch from 3417f5a to dfb6c44 Compare February 8, 2024 21:31
@dckc dckc changed the base branch from dc-test-preamble to main February 8, 2024 21:32
@dckc dckc force-pushed the dc-durable-upgrade branch 4 times, most recently from cbd9f3b to 515631d Compare February 9, 2024 23:48
@dckc dckc marked this pull request as ready for review February 9, 2024 23:49
Copy link
Collaborator

@Chris-Hibbert Chris-Hibbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the new rooms example work for you?

Yep. I like.


::: details What happens if we don't use baggage?

When the contract instance is restarted, it gets a fresh [heap](../js-programming/#vats-the-unit-of-synchrony), so [ordinary heap state](./contract-basics.html#state) does not survive upgrade. This implementation does not persist the effect of `E(publicFacet).set(2)` from the first incarnation:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be converted to a rooms example. Similarly in the following paragraph.

- Once the state is defined by the `init` function (3rd arg), properties cannot be added or removed.
- Values of state properties must be serializable.
- Values of state properties are hardened on assignment.
- You can replace the value of a state property (e.g. `state.zot = [...state.zot, 'last']`), and you can update stores (`state.players.set(1, player1)`), but you cannot do things like `state.zot.push('last')` nor `state.jot = { x: 1 }; state.jot.x = 2`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's unfortunate that state.jot = { x: 1 }; state.jot.x = 2 broke across a line for me. What do you think of making it a multiline expression to make it more apparent?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added a line-break

Copy link
Collaborator

@Chris-Hibbert Chris-Hibbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With one suggested change, this looks good to me.

@dckc dckc force-pushed the dc-durable-upgrade branch from f0d8424 to a594490 Compare February 17, 2024 04:56
dckc and others added 2 commits February 16, 2024 22:58
 - set off governance for upgrade
 - cite other relevant docs

publicFacet was a poor example of baggage key

chore: simplify number|string to just number in state example

chore: durable state snippet w/interface guard

 - regions for snippets
 - more concise

style: avoid arrowParens

build: add @agoric/zone for durability/upgrade snippets

chore: use rooms in heap state example to match durable

chore: include contract-upgrade in LHS TOC

Co-authored-by: Chris Hibbert <[email protected]>
@dckc dckc force-pushed the dc-durable-upgrade branch from a594490 to dad0201 Compare February 17, 2024 04:59
@dckc dckc enabled auto-merge (rebase) February 17, 2024 04:59
@dckc dckc merged commit 2ff7c4b into main Feb 17, 2024
4 checks passed
@dckc dckc deleted the dc-durable-upgrade branch February 17, 2024 05:03
@dckc dckc mentioned this pull request Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Document Durability, Upgrade
4 participants