@agoric/deploy-script-support 0.10.4-dev-b423dda.0 → 0.10.4-dev-b12a0f1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +77 -84
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -1,107 +1,100 @@
|
|
|
1
1
|
# Deploy Script Support
|
|
2
2
|
|
|
3
3
|
To install code on chain or in the a3p-integration environment, you'll have to
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
write a script to build the core proposal. The proposals' access to bootstrap
|
|
5
|
+
powers is limited by their manifests.
|
|
6
6
|
|
|
7
|
-
There are collections of proposals in
|
|
8
|
-
smart-wallet/src/proposals, orchestration/src/proposals, pegasus/src/proposals
|
|
7
|
+
There are collections of proposals in /vats/src/proposals,
|
|
8
|
+
smart-wallet/src/proposals, orchestration/src/proposals, pegasus/src/proposals,
|
|
9
|
+
and inter-protocol/src/proposals.
|
|
9
10
|
|
|
10
11
|
The overall format is a proposalBuilder script (There are several in
|
|
11
12
|
.../builders/scripts/vats/) which has a default export that passes resources to
|
|
12
13
|
the proposal. The resources include bundled source code and string-value
|
|
13
|
-
parameters. The
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
of source code needed by
|
|
14
|
+
parameters. The script exports a CoreEvalBuilder named `defaultProposalBuilder`
|
|
15
|
+
that specifies (as an import string) the proposal it uses, identifies the
|
|
16
|
+
"manifest", (which associates permissions to access powers in the bootstrap
|
|
17
|
+
space with functions to be called), and builds bundles of source code needed by
|
|
18
|
+
the proposal.
|
|
17
19
|
|
|
18
|
-
|
|
19
|
-
proposal to run is '@agoric/inter-protocol/src/proposals/upgrade-vaults.js',
|
|
20
|
-
lists the manifest there as `'getManifestForUpgradeVaults'`, and directs the
|
|
21
|
-
creation of a bundle from
|
|
22
|
-
'@agoric/inter-protocol/src/vaultFactory/vaultFactory.js', which will be made
|
|
23
|
-
available to the proposal as `vaultsRef` in options.
|
|
20
|
+
Here's a simple example:
|
|
24
21
|
|
|
25
|
-
`upgrade-vaults.js` defines `getManifestForUpgradeVaults()`, which returns a
|
|
26
|
-
`manifest` that says `upgradeVaults()` should be executed, and specifies what
|
|
27
|
-
powers it should have access to.
|
|
28
|
-
|
|
29
|
-
### Proposal
|
|
30
|
-
|
|
31
|
-
The proposal is called with `(powers, options)` available. The manifest
|
|
32
|
-
detailing the powers that will be used is usually in the same file, and
|
|
33
|
-
conventionally provided by a function named `getManifestForFoo`. The manifest
|
|
34
|
-
needs to have a unique name, since it will be referenced by name from the
|
|
35
|
-
script. The usual format is
|
|
36
|
-
```js
|
|
37
|
-
export const foo = async (
|
|
38
|
-
{
|
|
39
|
-
consume: {
|
|
40
|
-
...
|
|
41
|
-
},
|
|
42
|
-
brands: {
|
|
43
|
-
...
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
options,
|
|
47
|
-
) => {
|
|
48
|
-
const { fooRef } = options;
|
|
49
|
-
// do the things using powers and options
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export const getManifestForFoo = (powers, options) => {
|
|
53
|
-
manifest: {
|
|
54
|
-
[foo.name]: {
|
|
55
|
-
consume: {
|
|
56
|
-
...
|
|
57
|
-
},
|
|
58
|
-
options,
|
|
59
|
-
)};
|
|
60
22
|
```
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
**TODO** what happens with the `installations` in [`startPsm.js`](https://github.com/Agoric/agoric-sdk/blob/b13743a2cccf0cb63a412b54384435596d4e81ea/packages/inter-protocol/src/proposals/startPSM.js#L496)?
|
|
65
|
-
|
|
66
|
-
`options` allows the proposal to be provided with arbitray other powerful
|
|
67
|
-
objects.
|
|
68
|
-
|
|
69
|
-
### proposalBuilder Script
|
|
70
|
-
|
|
71
|
-
The script describes how to build the core proposal. For
|
|
72
|
-
`agoric-3-proposals` and uploading to the chain, the script must be named in the
|
|
73
|
-
`CoreProposalSteps` section in [`upgrade.go`](../../golang/cosmos/app/upgrade.go),
|
|
74
|
-
and its `defaultProposalBuilder` will be invoked directly.
|
|
75
|
-
|
|
76
|
-
Script files should export `defaultProposalBuilder` and a `default` function
|
|
77
|
-
that invokes `writeCoreProposal` one or more times to generate sets of files
|
|
78
|
-
describing the proposal.
|
|
79
|
-
|
|
80
|
-
```js
|
|
81
|
-
export const defaultProposalBuilder = ({ publishRef, install }) => {
|
|
23
|
+
/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
|
|
24
|
+
const game1ProposalBuilder = async ({ publishRef, install }) => {
|
|
82
25
|
return harden({
|
|
83
|
-
sourceSpec: '@agoric/
|
|
26
|
+
sourceSpec: '@agoric/smart-wallet/test/start-game1-proposal.js',
|
|
84
27
|
getManifestCall: [
|
|
85
|
-
|
|
28
|
+
getManifestForGame1.name,
|
|
86
29
|
{
|
|
87
|
-
|
|
88
|
-
|
|
30
|
+
game1Ref: publishRef(
|
|
31
|
+
install(
|
|
32
|
+
'@agoric/smart-wallet/test/gameAssetContract.js',
|
|
33
|
+
'../bundles/bundle-game1.js',
|
|
34
|
+
{ persist: true },
|
|
35
|
+
),
|
|
36
|
+
),
|
|
89
37
|
},
|
|
90
38
|
],
|
|
91
39
|
});
|
|
92
40
|
};
|
|
93
|
-
|
|
41
|
+
|
|
94
42
|
export default async (homeP, endowments) => {
|
|
95
|
-
const {
|
|
96
|
-
await
|
|
43
|
+
const { writeCoreEval } = await makeHelpers(homeP, endowments);
|
|
44
|
+
await writeCoreEval('start-game1', game1ProposalBuilder);
|
|
97
45
|
};
|
|
98
46
|
```
|
|
99
47
|
|
|
100
|
-
The first element of `getManifestCall` is interpreted as the name of a
|
|
101
|
-
The second element of `getManifestCall` produces the
|
|
102
|
-
to the
|
|
103
|
-
in options is a reference to code to be
|
|
104
|
-
above shows how. `publishRef(install(<path>))`
|
|
105
|
-
sdk, and passed as a `bundleRef`, which contains
|
|
106
|
-
passing to Zoe (for contracts) or `vatAdminService`
|
|
48
|
+
The first element of `getManifestCall` is interpreted as the name of a function
|
|
49
|
+
defining a behavior. The second element of `getManifestCall` produces the
|
|
50
|
+
`options` argument passed to the function (`{ game1Red }` in the example
|
|
51
|
+
above). A common thing to want to pass in `options` is a reference to code to be
|
|
52
|
+
installed on-chain. The example above shows how. `publishRef(install(<path>))`
|
|
53
|
+
is built from sources in agoric-sdk, and passed as a `bundleRef`, which contains
|
|
54
|
+
a `bundleID` suitable for passing to Zoe (for contracts) or `vatAdminService`
|
|
55
|
+
(for non-contract vat code).
|
|
56
|
+
|
|
57
|
+
The CoreEvalBuilder says the proposal to run is
|
|
58
|
+
'@agoric/smart-wallet/test/start-game1-proposal.js'. It says the manifest can be
|
|
59
|
+
produced by running `getManifestForGame1`, and directs the creation of bundles
|
|
60
|
+
from `@agoric/smart-wallet/test/gameAssetContract.js` which will be made
|
|
61
|
+
available to the proposal as `game1Ref` in `options`.
|
|
62
|
+
|
|
63
|
+
The manifest gives permissions for accessing objects in promise space, and
|
|
64
|
+
passes installations to the proposalBuilder. Notice that `game1Ref` from the
|
|
65
|
+
proposalBuilder is passed to `getManifestForGame1`, which adds it to
|
|
66
|
+
`installations`, with the name `game1`. The name provided for installations will
|
|
67
|
+
also be used to register the installation in `agoricNames`.
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
export const getManifestForGame1 = ({ restoreRef }, { game1Ref }) => {
|
|
71
|
+
return harden({
|
|
72
|
+
manifest: gameManifest,
|
|
73
|
+
installations: {
|
|
74
|
+
game1: restoreRef(game1Ref),
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Invoking the coreEval Behavior
|
|
81
|
+
|
|
82
|
+
The proposalBuilder script's default export is responsible for calling
|
|
83
|
+
`writeCoreEval()` to produce the scripts that will be evaluated by the chain.
|
|
84
|
+
These define behavior functions that will be invoked based on the keys in the
|
|
85
|
+
manifest and passed arguments declared in the manifest. The manifest is usually
|
|
86
|
+
in the same file, and conventionally provided by a function named
|
|
87
|
+
`getManifestForFoo`. The manifest needs to have a unique name, since it will be
|
|
88
|
+
referenced by name from the script.
|
|
89
|
+
|
|
90
|
+
### proposalBuilder Script
|
|
91
|
+
|
|
92
|
+
The script describes how to build the core proposal. Script files should export
|
|
93
|
+
`defaultProposalBuilder` and a `default` function that invokes
|
|
94
|
+
`writeCoreProposal` one or more times to generate sets of files describing the
|
|
95
|
+
proposal.
|
|
107
96
|
|
|
97
|
+
Chain-halting SoftwareUpgrades can include coreEvals, by adding them to the
|
|
98
|
+
`CoreProposalSteps` section in [`upgrade.go`](../../golang/cosmos/app/upgrade.go). To execute a proposal via
|
|
99
|
+
CoreEval, follow [the instructions at
|
|
100
|
+
docs.agoric.com](https://docs.agoric.com/guides/coreeval/local-testnet.html).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/deploy-script-support",
|
|
3
|
-
"version": "0.10.4-dev-
|
|
3
|
+
"version": "0.10.4-dev-b12a0f1.0+b12a0f1",
|
|
4
4
|
"description": "Helpers and other support for writing deploy scripts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/helpers.js",
|
|
@@ -34,13 +34,13 @@
|
|
|
34
34
|
},
|
|
35
35
|
"homepage": "https://github.com/Agoric/agoric-sdk#readme",
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@agoric/ertp": "0.16.3-dev-
|
|
38
|
-
"@agoric/import-manager": "0.3.12-dev-
|
|
39
|
-
"@agoric/internal": "0.3.3-dev-
|
|
40
|
-
"@agoric/notifier": "0.6.3-dev-
|
|
41
|
-
"@agoric/store": "0.9.3-dev-
|
|
42
|
-
"@agoric/time": "0.3.3-dev-
|
|
43
|
-
"@agoric/zoe": "0.26.3-dev-
|
|
37
|
+
"@agoric/ertp": "0.16.3-dev-b12a0f1.0+b12a0f1",
|
|
38
|
+
"@agoric/import-manager": "0.3.12-dev-b12a0f1.0+b12a0f1",
|
|
39
|
+
"@agoric/internal": "0.3.3-dev-b12a0f1.0+b12a0f1",
|
|
40
|
+
"@agoric/notifier": "0.6.3-dev-b12a0f1.0+b12a0f1",
|
|
41
|
+
"@agoric/store": "0.9.3-dev-b12a0f1.0+b12a0f1",
|
|
42
|
+
"@agoric/time": "0.3.3-dev-b12a0f1.0+b12a0f1",
|
|
43
|
+
"@agoric/zoe": "0.26.3-dev-b12a0f1.0+b12a0f1",
|
|
44
44
|
"@endo/base64": "^1.0.7",
|
|
45
45
|
"@endo/bundle-source": "^3.4.0",
|
|
46
46
|
"@endo/errors": "^1.2.5",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@endo/zip": "^1.0.7"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@agoric/vats": "0.15.2-dev-
|
|
54
|
+
"@agoric/vats": "0.15.2-dev-b12a0f1.0+b12a0f1",
|
|
55
55
|
"@endo/init": "^1.1.4",
|
|
56
56
|
"ava": "^5.3.0",
|
|
57
57
|
"import-meta-resolve": "^2.2.1"
|
|
@@ -74,5 +74,5 @@
|
|
|
74
74
|
"typeCoverage": {
|
|
75
75
|
"atLeast": 82.6
|
|
76
76
|
},
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "b12a0f16a0a2240a172827e0fe4439843445b84d"
|
|
78
78
|
}
|