@agoric/deploy-script-support 0.10.4-upgrade-16-fi-dev-8879538.0 → 0.10.4-upgrade-16-dev-f908f89.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/deploy-script-support",
|
|
3
|
-
"version": "0.10.4-upgrade-16-
|
|
3
|
+
"version": "0.10.4-upgrade-16-dev-f908f89.0+f908f89",
|
|
4
4
|
"description": "Helpers and other support for writing deploy scripts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/helpers.js",
|
|
@@ -34,14 +34,14 @@
|
|
|
34
34
|
},
|
|
35
35
|
"homepage": "https://github.com/Agoric/agoric-sdk#readme",
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@agoric/assert": "0.6.1-upgrade-16-
|
|
38
|
-
"@agoric/ertp": "0.16.3-upgrade-16-
|
|
39
|
-
"@agoric/import-manager": "0.3.12-upgrade-16-
|
|
40
|
-
"@agoric/internal": "0.3.3-upgrade-16-
|
|
41
|
-
"@agoric/notifier": "0.6.3-upgrade-16-
|
|
42
|
-
"@agoric/store": "0.9.3-upgrade-16-
|
|
43
|
-
"@agoric/time": "0.3.3-upgrade-16-
|
|
44
|
-
"@agoric/zoe": "0.26.3-upgrade-16-
|
|
37
|
+
"@agoric/assert": "0.6.1-upgrade-16-dev-f908f89.0+f908f89",
|
|
38
|
+
"@agoric/ertp": "0.16.3-upgrade-16-dev-f908f89.0+f908f89",
|
|
39
|
+
"@agoric/import-manager": "0.3.12-upgrade-16-dev-f908f89.0+f908f89",
|
|
40
|
+
"@agoric/internal": "0.3.3-upgrade-16-dev-f908f89.0+f908f89",
|
|
41
|
+
"@agoric/notifier": "0.6.3-upgrade-16-dev-f908f89.0+f908f89",
|
|
42
|
+
"@agoric/store": "0.9.3-upgrade-16-dev-f908f89.0+f908f89",
|
|
43
|
+
"@agoric/time": "0.3.3-upgrade-16-dev-f908f89.0+f908f89",
|
|
44
|
+
"@agoric/zoe": "0.26.3-upgrade-16-dev-f908f89.0+f908f89",
|
|
45
45
|
"@endo/base64": "^1.0.5",
|
|
46
46
|
"@endo/bundle-source": "^3.2.3",
|
|
47
47
|
"@endo/far": "^1.1.2",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@endo/zip": "^1.0.5"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@agoric/vats": "0.15.2-upgrade-16-
|
|
54
|
+
"@agoric/vats": "0.15.2-upgrade-16-dev-f908f89.0+f908f89",
|
|
55
55
|
"@endo/init": "^1.1.2",
|
|
56
56
|
"ava": "^5.3.0",
|
|
57
57
|
"import-meta-resolve": "^2.2.1"
|
|
@@ -74,5 +74,5 @@
|
|
|
74
74
|
"typeCoverage": {
|
|
75
75
|
"atLeast": 81.63
|
|
76
76
|
},
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "f908f89186162df83b540f6aeb1f4c665c3a56b4"
|
|
78
78
|
}
|
|
@@ -24,7 +24,7 @@ const t = 'makeCoreProposalBehavior';
|
|
|
24
24
|
* They are merged with all of the manifest getter's permits to produce the
|
|
25
25
|
* total permits needed by the resulting core proposal (such as might be---and
|
|
26
26
|
* generally are---written into a *-permit.json file).
|
|
27
|
-
* @see {@link ./
|
|
27
|
+
* @see {@link ./writeCoreEvalParts.js}
|
|
28
28
|
*/
|
|
29
29
|
export const permits = {
|
|
30
30
|
consume: { agoricNamesAdmin: t, vatAdminSvc: t, zoe: t },
|
|
@@ -106,7 +106,7 @@ export const makeCoreProposalBehavior = ({
|
|
|
106
106
|
// HOWEVER, do note that this function is invoked with at least the *union* of powers
|
|
107
107
|
// required by individual moduleBehaviors declared by the manifest getter, which is
|
|
108
108
|
// necessary so it can use `runModuleBehaviors` to provide the appropriate subset to
|
|
109
|
-
// each one (see ./
|
|
109
|
+
// each one (see ./writeCoreEvalParts.js).
|
|
110
110
|
// Handle `powers` with the requisite care.
|
|
111
111
|
const {
|
|
112
112
|
consume: { vatAdminSvc, zoe, agoricNamesAdmin },
|
package/src/externalTypes.js
CHANGED
|
@@ -9,12 +9,6 @@ export {};
|
|
|
9
9
|
* origin. We are migrating away from using plain strings, for consistency.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
/**
|
|
13
|
-
* @typedef ProposalResult
|
|
14
|
-
* @property {string} sourceSpec
|
|
15
|
-
* @property {[exportedGetManifest: string, ...manifestArgs: any[]]} getManifestCall
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
12
|
/**
|
|
19
13
|
* @typedef {{fileName?: string} & ({ bundleName: string } | { bundleID: string}) } ManifestBundleRef
|
|
20
14
|
*/
|
|
@@ -34,12 +28,22 @@ export {};
|
|
|
34
28
|
*/
|
|
35
29
|
|
|
36
30
|
/**
|
|
37
|
-
* @
|
|
31
|
+
* @typedef CoreEvalDescriptor
|
|
32
|
+
* @property {string} sourceSpec import specifier for a module
|
|
33
|
+
* @property {[manifestGetterName: string, ...manifestGetterArgs: any[]]} getManifestCall
|
|
34
|
+
* the name of a function exported by the module and arguments to invoke it
|
|
35
|
+
* with in order to get a manifest (a Record that associates functions to be
|
|
36
|
+
* invoked and permits defining bootstrap-space powers they will have access
|
|
37
|
+
* to, see {@link ../README.md} and {@link runModuleBehaviors})
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @callback CoreEvalBuilder
|
|
38
42
|
* @param {{
|
|
39
43
|
* publishRef: PublishBundleRef,
|
|
40
44
|
* install: InstallEntrypoint,
|
|
41
45
|
* wrapInstall?: <T extends InstallEntrypoint>(f: T) => T }
|
|
42
46
|
* } powers
|
|
43
47
|
* @param {...any} args
|
|
44
|
-
* @returns {Promise<
|
|
48
|
+
* @returns {Promise<CoreEvalDescriptor>}
|
|
45
49
|
*/
|
package/src/extract-proposal.js
CHANGED
|
@@ -156,7 +156,7 @@ export const extractCoreProposalBundles = async (
|
|
|
156
156
|
const thisProposalSequence = getSequenceForProposal(key);
|
|
157
157
|
const initPath = findModule(dirname, module);
|
|
158
158
|
const initDir = path.dirname(initPath);
|
|
159
|
-
/** @type {Record<string, import('./externalTypes.js').
|
|
159
|
+
/** @type {Record<string, import('./externalTypes.js').CoreEvalBuilder>} */
|
|
160
160
|
const ns = await import(initPath);
|
|
161
161
|
const install = (srcSpec, bundlePath) => {
|
|
162
162
|
const absoluteSrc = findModule(initDir, srcSpec);
|
package/src/helpers.js
CHANGED
|
@@ -17,7 +17,7 @@ import { makeSaveIssuer } from './saveIssuer.js';
|
|
|
17
17
|
import { makeGetBundlerMaker } from './getBundlerMaker.js';
|
|
18
18
|
import { assertOfferResult } from './assertOfferResult.js';
|
|
19
19
|
import { installInPieces } from './installInPieces.js';
|
|
20
|
-
import {
|
|
20
|
+
import { makeWriteCoreEval } from './writeCoreEvalParts.js';
|
|
21
21
|
|
|
22
22
|
export * from '@agoric/internal/src/node/createBundles.js';
|
|
23
23
|
|
|
@@ -137,8 +137,16 @@ export const makeHelpers = async (homePromise, endowments) => {
|
|
|
137
137
|
get getBundlerMaker() {
|
|
138
138
|
return makeGetBundlerMaker(homePromise, { bundleSource, lookup });
|
|
139
139
|
},
|
|
140
|
+
/** @returns {import('./writeCoreEvalParts.js').WriteCoreEval} */
|
|
141
|
+
get writeCoreEval() {
|
|
142
|
+
return makeWriteCoreEval(homePromise, endowments, {
|
|
143
|
+
getBundleSpec: deps.cacheAndGetBundleSpec,
|
|
144
|
+
getBundlerMaker: helpers.getBundlerMaker,
|
|
145
|
+
});
|
|
146
|
+
},
|
|
147
|
+
/** @deprecated use writeCoreEval */
|
|
140
148
|
get writeCoreProposal() {
|
|
141
|
-
return
|
|
149
|
+
return makeWriteCoreEval(homePromise, endowments, {
|
|
142
150
|
getBundleSpec: deps.cacheAndGetBundleSpec,
|
|
143
151
|
getBundlerMaker: helpers.getBundlerMaker,
|
|
144
152
|
});
|
|
@@ -5,28 +5,48 @@ import { deeplyFulfilled } from '@endo/marshal';
|
|
|
5
5
|
|
|
6
6
|
import { createBundles } from '@agoric/internal/src/node/createBundles.js';
|
|
7
7
|
import { defangAndTrim, mergePermits, stringify } from './code-gen.js';
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
makeCoreProposalBehavior,
|
|
10
|
+
permits as defaultPermits,
|
|
11
|
+
} from './coreProposalBehavior.js';
|
|
9
12
|
|
|
10
13
|
/**
|
|
11
|
-
* @
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
* @import {CoreEvalDescriptor} from './externalTypes.js';
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @typedef CoreEvalPlan
|
|
19
|
+
* @property {string} name
|
|
20
|
+
* @property {string} permit
|
|
21
|
+
* @property {string} script
|
|
22
|
+
* @property {{entrypoint: string, bundleID: string, fileName: string}[]} bundles
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @callback WriteCoreEval write to disk the files needed for a CoreEval (js code to`${filePrefix}.js`, permits to `${filePrefix}-permit.json`, an overall
|
|
27
|
+
* summary to `${filePrefix}-plan.json), plus whatever bundles bundles the code loads)
|
|
28
|
+
* see CoreEval in {@link '/golang/cosmos/x/swingset/types/swingset.pb.go'}
|
|
29
|
+
* @param {string} filePrefix name on disk
|
|
30
|
+
* @param {import('./externalTypes.js').CoreEvalBuilder} builder
|
|
31
|
+
* @returns {Promise<CoreEvalPlan>}
|
|
15
32
|
*/
|
|
16
33
|
|
|
17
34
|
/**
|
|
18
35
|
*
|
|
19
36
|
* @param {*} homeP
|
|
20
|
-
* @param {
|
|
37
|
+
* @param {{
|
|
38
|
+
* bundleSource: (path: string) => Promise<NodeModule>,
|
|
39
|
+
* pathResolve: (path: string) => string,
|
|
40
|
+
* }} endowments
|
|
21
41
|
* @param {{
|
|
22
42
|
* getBundlerMaker: () => Promise<import('./getBundlerMaker.js').BundleMaker>,
|
|
23
43
|
* getBundleSpec: (...args: *) => Promise<import('./externalTypes.js').ManifestBundleRef>,
|
|
24
44
|
* log?: typeof console.log,
|
|
25
45
|
* writeFile?: typeof fs.promises.writeFile
|
|
26
46
|
* }} io
|
|
27
|
-
* @returns {
|
|
47
|
+
* @returns {WriteCoreEval}
|
|
28
48
|
*/
|
|
29
|
-
export const
|
|
49
|
+
export const makeWriteCoreEval = (
|
|
30
50
|
homeP,
|
|
31
51
|
endowments,
|
|
32
52
|
{
|
|
@@ -49,16 +69,21 @@ export const makeWriteCoreProposal = (
|
|
|
49
69
|
return bundlerCache;
|
|
50
70
|
};
|
|
51
71
|
|
|
52
|
-
|
|
72
|
+
/**
|
|
73
|
+
*
|
|
74
|
+
* @param {CoreEvalDescriptor} coreEval
|
|
75
|
+
* @param {*} additionalPermits
|
|
76
|
+
*/
|
|
77
|
+
const mergeEvalPermit = async (coreEval, additionalPermits) => {
|
|
53
78
|
const {
|
|
54
79
|
sourceSpec,
|
|
55
80
|
getManifestCall: [manifestGetterName, ...manifestGetterArgs],
|
|
56
|
-
} =
|
|
81
|
+
} = coreEval;
|
|
57
82
|
|
|
58
|
-
const
|
|
83
|
+
const moduleNamespace = await import(pathResolve(sourceSpec));
|
|
59
84
|
|
|
60
85
|
// We only care about the manifest, not any restoreRef calls.
|
|
61
|
-
const { manifest } = await
|
|
86
|
+
const { manifest } = await moduleNamespace[manifestGetterName](
|
|
62
87
|
harden({ restoreRef: x => `restoreRef:${x}` }),
|
|
63
88
|
...manifestGetterArgs,
|
|
64
89
|
);
|
|
@@ -74,8 +99,8 @@ export const makeWriteCoreProposal = (
|
|
|
74
99
|
/** @type {Promise<import('./externalTypes.js').ManifestBundleRef | undefined>} */ (
|
|
75
100
|
Promise.resolve()
|
|
76
101
|
);
|
|
77
|
-
/** @type {
|
|
78
|
-
const
|
|
102
|
+
/** @type {WriteCoreEval} */
|
|
103
|
+
const writeCoreEval = async (filePrefix, builder) => {
|
|
79
104
|
/**
|
|
80
105
|
*
|
|
81
106
|
* @param {string} entrypoint
|
|
@@ -131,23 +156,23 @@ export const makeWriteCoreProposal = (
|
|
|
131
156
|
return harden(ref);
|
|
132
157
|
};
|
|
133
158
|
|
|
134
|
-
// Create the
|
|
135
|
-
const
|
|
136
|
-
harden(
|
|
159
|
+
// Create the eval structure.
|
|
160
|
+
const evalDescriptor = await deeplyFulfilled(
|
|
161
|
+
harden(builder({ publishRef, install })),
|
|
137
162
|
);
|
|
138
|
-
const { sourceSpec, getManifestCall } =
|
|
163
|
+
const { sourceSpec, getManifestCall } = evalDescriptor;
|
|
139
164
|
// console.log('created', { filePrefix, sourceSpec, getManifestCall });
|
|
140
165
|
|
|
141
166
|
// Extract the top-level permit.
|
|
142
|
-
const { permits:
|
|
143
|
-
await
|
|
167
|
+
const { permits: evalPermits, manifest: customManifest } =
|
|
168
|
+
await mergeEvalPermit(evalDescriptor, defaultPermits);
|
|
144
169
|
|
|
145
170
|
// Get an install
|
|
146
171
|
const manifestBundleRef = await publishRef(install(sourceSpec));
|
|
147
172
|
|
|
148
173
|
// console.log('writing', { filePrefix, manifestBundleRef, sourceSpec });
|
|
149
174
|
const code = `\
|
|
150
|
-
// This is generated by
|
|
175
|
+
// This is generated by writeCoreEval; please edit!
|
|
151
176
|
/* eslint-disable */
|
|
152
177
|
|
|
153
178
|
const manifestBundleRef = ${stringify(manifestBundleRef)};
|
|
@@ -164,21 +189,19 @@ behavior;
|
|
|
164
189
|
|
|
165
190
|
const trimmed = defangAndTrim(code);
|
|
166
191
|
|
|
167
|
-
const
|
|
168
|
-
log(`creating ${
|
|
169
|
-
await writeFile(
|
|
170
|
-
proposalPermitJsonFile,
|
|
171
|
-
JSON.stringify(proposalPermit, null, 2),
|
|
172
|
-
);
|
|
192
|
+
const permitFile = `${filePrefix}-permit.json`;
|
|
193
|
+
log(`creating ${permitFile}`);
|
|
194
|
+
await writeFile(permitFile, JSON.stringify(evalPermits, null, 2));
|
|
173
195
|
|
|
174
|
-
const
|
|
175
|
-
log(`creating ${
|
|
176
|
-
await writeFile(
|
|
196
|
+
const codeFile = `${filePrefix}.js`;
|
|
197
|
+
log(`creating ${codeFile}`);
|
|
198
|
+
await writeFile(codeFile, trimmed);
|
|
177
199
|
|
|
200
|
+
/** @type {CoreEvalPlan} */
|
|
178
201
|
const plan = {
|
|
179
202
|
name: filePrefix,
|
|
180
|
-
script:
|
|
181
|
-
permit:
|
|
203
|
+
script: codeFile,
|
|
204
|
+
permit: permitFile,
|
|
182
205
|
bundles,
|
|
183
206
|
};
|
|
184
207
|
|
|
@@ -189,13 +212,16 @@ behavior;
|
|
|
189
212
|
|
|
190
213
|
log(`\
|
|
191
214
|
You can now run a governance submission command like:
|
|
192
|
-
agd tx gov submit-proposal swingset-core-eval ${
|
|
193
|
-
--title="Enable <something>" --description="Evaluate ${
|
|
215
|
+
agd tx gov submit-proposal swingset-core-eval ${permitFile} ${codeFile} \\
|
|
216
|
+
--title="Enable <something>" --description="Evaluate ${codeFile}" --deposit=1000000ubld \\
|
|
194
217
|
--gas=auto --gas-adjustment=1.2
|
|
195
218
|
Remember to install bundles before submitting the proposal:
|
|
196
219
|
${cmds.join('\n ')}
|
|
197
220
|
`);
|
|
221
|
+
return plan;
|
|
198
222
|
};
|
|
199
223
|
|
|
200
|
-
return
|
|
224
|
+
return writeCoreEval;
|
|
201
225
|
};
|
|
226
|
+
/** @deprecated use makeWriteCoreEval */
|
|
227
|
+
export const makeWriteCoreProposal = makeWriteCoreEval;
|