Durable contracts#1255
Conversation
Deploying documentation with
|
| Latest commit: |
0335f86
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://8944fae8.documentation-7tp.pages.dev |
| Branch Preview URL: | https://durablecontracts.documentation-7tp.pages.dev |
7a91dde to
5a72a8c
Compare
|
Lint is failing and claiming there are warnings for two files. When I run |
dckc
left a comment
There was a problem hiding this comment.
Fixing the links is important.
The rest of the comments are just suggestions.
|
|
||
| The first step toward contracts that can be upgraded is storing all the data that a later incarnation will | ||
| need. This means putting relevant state in | ||
| [Baggage](http://localhost:5173/guides/zoe/contract-upgrade.html#baggage), and ensuring that reachable objects |
There was a problem hiding this comment.
some localhost links crept in. And "links should ... exclude the file extension" per contributing docs on writing links
| [Baggage](http://localhost:5173/guides/zoe/contract-upgrade.html#baggage), and ensuring that reachable objects | |
| [Baggage](/guides/zoe/contract-upgrade#baggage), and ensuring that reachable objects |
| Our persistent objects are designed to encapsulate their state, and can present different facets to different | ||
| clients to distinguish different aspects of authority. `zone.exoClass()` defines a kind with a single facet, | ||
| while `zone.exoClassKit()` defines a kind with multiple facets. (Here are some relevant [naming | ||
| conventions](https://docs.agoric.com/guides/ertp/#method-naming-structure).) |
There was a problem hiding this comment.
use relative links to facilitate local preview:
| conventions](https://docs.agoric.com/guides/ertp/#method-naming-structure).) | |
| conventions](/guides/ertp/#method-naming-structure).) |
| The result of starting a contract includes the right to upgrade the contract instance. A call to [E(zoe).startInstance(...)](/reference/zoe-api/zoe.md#e-zoe-startinstance-installation-issuerkeywordrecord-terms-privateargs) returns a record of several objects that represent different levels of access. | ||
| The `publicFacet` and `creatorFacet` are defined by the contract. | ||
| The `adminFacet` is defined by Zoe and includes methods to upgrade the contract. | ||
| The return value when starting a contract includes a capability that conveys the right to upgrade |
There was a problem hiding this comment.
"a capability that conveys the right" seems wordy; how about...
| The return value when starting a contract includes a capability that conveys the right to upgrade | |
| The return value when starting a contract includes a capability to upgrade |
| The return value when starting a contract includes a capability that conveys the right to upgrade | ||
| the contract instance. A call to | ||
| [E(zoe).startInstance(...)](/reference/zoe-api/zoe.md#e-zoe-startinstance-installation-issuerkeywordrecord-terms-privateargs) | ||
| returns a record of several objects that carry different powers. The `publicFacet` and |
There was a problem hiding this comment.
The change from "represent different levels of access" to "carry different powers" seems to make things more obscure. I think typical readers are much more likely to be familiar with levels access than "powers".
Perhaps "... returns a kit of facets; that is: a record of several objects that represent different ways to access the contract instance" with kit and facets linked to glossary entries.
Another option would be to leave most of that to the startInstance docs: "Recall that E(zoe).startInstance(...) returns a record including an adminFacet property. This adminFacet includes methods to upgrade the contract instance."
There was a problem hiding this comment.
I don't like "levels of access". "kit of facets" (with links) works for me.
| `start`. (We used to indicate upgradability by using `prepare` instead of `start`, but that | ||
| approach is deprecated.)` |
There was a problem hiding this comment.
| `start`. (We used to indicate upgradability by using `prepare` instead of `start`, but that | |
| approach is deprecated.)` | |
| `start`. (_We used to indicate upgradability by using `prepare` instead of `start`, but that | |
| approach is deprecated._)` |
| Fields of the object returned by the `init` function become fields of the persistent state. (These cannot | ||
| currently be changed on upgrade, though we're considering relaxing that restriction.) Within methods they can |
There was a problem hiding this comment.
| Fields of the object returned by the `init` function become fields of the persistent state. (These cannot | |
| currently be changed on upgrade, though we're considering relaxing that restriction.) Within methods they can | |
| Fields of the object returned by the `init` function become fields of the persistent state. (_These cannot | |
| currently be changed on upgrade, though we're considering relaxing that restriction._) Within methods they can |
|
|
||
| ### Methods: defining behavior | ||
|
|
||
| The methods argument of `exoClass()` is a bag of methods, written in [concise method |
There was a problem hiding this comment.
| The methods argument of `exoClass()` is a bag of methods, written in [concise method | |
| The methods argument of `exoClass()` is a collection of methods, written in [concise method |
or "... record of methods ..."
There was a problem hiding this comment.
done. I like "record" here.
| syntax](https://github.com/Agoric/agoric-sdk/wiki/Arrow-Function-Style#far-classes-do-not-use-arrow-function-style). | ||
| `exoClass()` defines a single facet. | ||
|
|
||
| The methodKit parameter to `exoClassKit` is a record of labelled bags of methods. Each label defines a facet |
There was a problem hiding this comment.
| The methodKit parameter to `exoClassKit` is a record of labelled bags of methods. Each label defines a facet | |
| The methodKit parameter to `exoClassKit` is a record where each value is a collection of methods. Each property defines a facet |
|
|
||
| [Zone](http://localhost:5173/glossary/#zone) provides an interface for defining objects and classes that | ||
| supports both ephemeral objects (allocated on the heap), and durable objects that can persist and that | ||
| SwingSet will page in or out on demand. |
There was a problem hiding this comment.
Is "SwingSet" in the reader's vocabulary at this point? Link to glossary entry?
| result matches before invoking the method. When a guard is written this latter way, the method doesn't have to | ||
| be `async`. In both cases, the method doesn't have to check for compliance with the guard. | ||
|
|
||
| [Shapes can specify](https://endojs.github.io/endo/interfaces/_endo_patterns.PatternMatchers.html) simple |
There was a problem hiding this comment.
I made a patterns cheat-sheet at https://docs.agoric.com/reference/zoe-api/zoe-contract-facet.html#proposal-shapes, but that context is specialized to proposal shapes. hm.
Perhaps using glossary entries for Pattern and Shape would help. Perhaps I should do that in a follow-up PR.
Thanks, Dan!
closes: #1126
Description
Collect the details on creating durable contracts in one place. Update to cover use of
metawithstartand stop recommendingpreparefor this.Also provide some cross-linking between various descriptions of the approach.