@agoric/deploy-script-support 0.10.4-dev-27cc9b8.0 → 0.10.4-dev-96c19f5.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-dev-
|
|
3
|
+
"version": "0.10.4-dev-96c19f5.0+96c19f5",
|
|
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-dev-
|
|
38
|
-
"@agoric/ertp": "0.16.3-dev-
|
|
39
|
-
"@agoric/import-manager": "0.3.12-dev-
|
|
40
|
-
"@agoric/internal": "0.3.3-dev-
|
|
41
|
-
"@agoric/notifier": "0.6.3-dev-
|
|
42
|
-
"@agoric/store": "0.9.3-dev-
|
|
43
|
-
"@agoric/time": "0.3.3-dev-
|
|
44
|
-
"@agoric/zoe": "0.26.3-dev-
|
|
37
|
+
"@agoric/assert": "0.6.1-dev-96c19f5.0+96c19f5",
|
|
38
|
+
"@agoric/ertp": "0.16.3-dev-96c19f5.0+96c19f5",
|
|
39
|
+
"@agoric/import-manager": "0.3.12-dev-96c19f5.0+96c19f5",
|
|
40
|
+
"@agoric/internal": "0.3.3-dev-96c19f5.0+96c19f5",
|
|
41
|
+
"@agoric/notifier": "0.6.3-dev-96c19f5.0+96c19f5",
|
|
42
|
+
"@agoric/store": "0.9.3-dev-96c19f5.0+96c19f5",
|
|
43
|
+
"@agoric/time": "0.3.3-dev-96c19f5.0+96c19f5",
|
|
44
|
+
"@agoric/zoe": "0.26.3-dev-96c19f5.0+96c19f5",
|
|
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-dev-
|
|
54
|
+
"@agoric/vats": "0.15.2-dev-96c19f5.0+96c19f5",
|
|
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": "96c19f54bd17fd616883713d372a9dc8ca0140f9"
|
|
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,40 @@ 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
|
+
* @import {CoreEvalDescriptor} from './externalTypes.js';
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @callback WriteCoreEval write to disk the files needed for a CoreEval (js code to`${filePrefix}.js`, permits to `${filePrefix}-permit.json`, an overall
|
|
19
|
+
* summary to `${filePrefix}-plan.json), plus whatever bundles bundles the code loads)
|
|
20
|
+
* see CoreEval in {@link '/golang/cosmos/x/swingset/types/swingset.pb.go'}
|
|
21
|
+
* @param {string} filePrefix name on disk
|
|
22
|
+
* @param {import('./externalTypes.js').CoreEvalBuilder} builder
|
|
14
23
|
* @returns {Promise<void>}
|
|
15
24
|
*/
|
|
16
25
|
|
|
17
26
|
/**
|
|
18
27
|
*
|
|
19
28
|
* @param {*} homeP
|
|
20
|
-
* @param {
|
|
29
|
+
* @param {{
|
|
30
|
+
* bundleSource: (path: string) => Promise<NodeModule>,
|
|
31
|
+
* pathResolve: (path: string) => string,
|
|
32
|
+
* }} endowments
|
|
21
33
|
* @param {{
|
|
22
34
|
* getBundlerMaker: () => Promise<import('./getBundlerMaker.js').BundleMaker>,
|
|
23
35
|
* getBundleSpec: (...args: *) => Promise<import('./externalTypes.js').ManifestBundleRef>,
|
|
24
36
|
* log?: typeof console.log,
|
|
25
37
|
* writeFile?: typeof fs.promises.writeFile
|
|
26
38
|
* }} io
|
|
27
|
-
* @returns {
|
|
39
|
+
* @returns {WriteCoreEval}
|
|
28
40
|
*/
|
|
29
|
-
export const
|
|
41
|
+
export const makeWriteCoreEval = (
|
|
30
42
|
homeP,
|
|
31
43
|
endowments,
|
|
32
44
|
{
|
|
@@ -49,16 +61,21 @@ export const makeWriteCoreProposal = (
|
|
|
49
61
|
return bundlerCache;
|
|
50
62
|
};
|
|
51
63
|
|
|
52
|
-
|
|
64
|
+
/**
|
|
65
|
+
*
|
|
66
|
+
* @param {CoreEvalDescriptor} coreEval
|
|
67
|
+
* @param {*} additionalPermits
|
|
68
|
+
*/
|
|
69
|
+
const mergeEvalPermit = async (coreEval, additionalPermits) => {
|
|
53
70
|
const {
|
|
54
71
|
sourceSpec,
|
|
55
72
|
getManifestCall: [manifestGetterName, ...manifestGetterArgs],
|
|
56
|
-
} =
|
|
73
|
+
} = coreEval;
|
|
57
74
|
|
|
58
|
-
const
|
|
75
|
+
const moduleNamespace = await import(pathResolve(sourceSpec));
|
|
59
76
|
|
|
60
77
|
// We only care about the manifest, not any restoreRef calls.
|
|
61
|
-
const { manifest } = await
|
|
78
|
+
const { manifest } = await moduleNamespace[manifestGetterName](
|
|
62
79
|
harden({ restoreRef: x => `restoreRef:${x}` }),
|
|
63
80
|
...manifestGetterArgs,
|
|
64
81
|
);
|
|
@@ -74,8 +91,8 @@ export const makeWriteCoreProposal = (
|
|
|
74
91
|
/** @type {Promise<import('./externalTypes.js').ManifestBundleRef | undefined>} */ (
|
|
75
92
|
Promise.resolve()
|
|
76
93
|
);
|
|
77
|
-
/** @type {
|
|
78
|
-
const
|
|
94
|
+
/** @type {WriteCoreEval} */
|
|
95
|
+
const writeCoreEval = async (filePrefix, builder) => {
|
|
79
96
|
/**
|
|
80
97
|
*
|
|
81
98
|
* @param {string} entrypoint
|
|
@@ -131,23 +148,23 @@ export const makeWriteCoreProposal = (
|
|
|
131
148
|
return harden(ref);
|
|
132
149
|
};
|
|
133
150
|
|
|
134
|
-
// Create the
|
|
135
|
-
const
|
|
136
|
-
harden(
|
|
151
|
+
// Create the eval structure.
|
|
152
|
+
const evalDescriptor = await deeplyFulfilled(
|
|
153
|
+
harden(builder({ publishRef, install })),
|
|
137
154
|
);
|
|
138
|
-
const { sourceSpec, getManifestCall } =
|
|
155
|
+
const { sourceSpec, getManifestCall } = evalDescriptor;
|
|
139
156
|
// console.log('created', { filePrefix, sourceSpec, getManifestCall });
|
|
140
157
|
|
|
141
158
|
// Extract the top-level permit.
|
|
142
|
-
const { permits:
|
|
143
|
-
await
|
|
159
|
+
const { permits: evalPermits, manifest: customManifest } =
|
|
160
|
+
await mergeEvalPermit(evalDescriptor, defaultPermits);
|
|
144
161
|
|
|
145
162
|
// Get an install
|
|
146
163
|
const manifestBundleRef = await publishRef(install(sourceSpec));
|
|
147
164
|
|
|
148
165
|
// console.log('writing', { filePrefix, manifestBundleRef, sourceSpec });
|
|
149
166
|
const code = `\
|
|
150
|
-
// This is generated by
|
|
167
|
+
// This is generated by writeCoreEval; please edit!
|
|
151
168
|
/* eslint-disable */
|
|
152
169
|
|
|
153
170
|
const manifestBundleRef = ${stringify(manifestBundleRef)};
|
|
@@ -164,21 +181,18 @@ behavior;
|
|
|
164
181
|
|
|
165
182
|
const trimmed = defangAndTrim(code);
|
|
166
183
|
|
|
167
|
-
const
|
|
168
|
-
log(`creating ${
|
|
169
|
-
await writeFile(
|
|
170
|
-
proposalPermitJsonFile,
|
|
171
|
-
JSON.stringify(proposalPermit, null, 2),
|
|
172
|
-
);
|
|
184
|
+
const permitFile = `${filePrefix}-permit.json`;
|
|
185
|
+
log(`creating ${permitFile}`);
|
|
186
|
+
await writeFile(permitFile, JSON.stringify(evalPermits, null, 2));
|
|
173
187
|
|
|
174
|
-
const
|
|
175
|
-
log(`creating ${
|
|
176
|
-
await writeFile(
|
|
188
|
+
const codeFile = `${filePrefix}.js`;
|
|
189
|
+
log(`creating ${codeFile}`);
|
|
190
|
+
await writeFile(codeFile, trimmed);
|
|
177
191
|
|
|
178
192
|
const plan = {
|
|
179
193
|
name: filePrefix,
|
|
180
|
-
script:
|
|
181
|
-
permit:
|
|
194
|
+
script: codeFile,
|
|
195
|
+
permit: permitFile,
|
|
182
196
|
bundles,
|
|
183
197
|
};
|
|
184
198
|
|
|
@@ -189,13 +203,15 @@ behavior;
|
|
|
189
203
|
|
|
190
204
|
log(`\
|
|
191
205
|
You can now run a governance submission command like:
|
|
192
|
-
agd tx gov submit-proposal swingset-core-eval ${
|
|
193
|
-
--title="Enable <something>" --description="Evaluate ${
|
|
206
|
+
agd tx gov submit-proposal swingset-core-eval ${permitFile} ${codeFile} \\
|
|
207
|
+
--title="Enable <something>" --description="Evaluate ${codeFile}" --deposit=1000000ubld \\
|
|
194
208
|
--gas=auto --gas-adjustment=1.2
|
|
195
209
|
Remember to install bundles before submitting the proposal:
|
|
196
210
|
${cmds.join('\n ')}
|
|
197
211
|
`);
|
|
198
212
|
};
|
|
199
213
|
|
|
200
|
-
return
|
|
214
|
+
return writeCoreEval;
|
|
201
215
|
};
|
|
216
|
+
/** @deprecated use makeWriteCoreEval */
|
|
217
|
+
export const makeWriteCoreProposal = makeWriteCoreEval;
|