@agoric/vats 0.15.2-dev-aa6629d.0.aa6629d → 0.15.2-dev-f212cfd.0.f212cfd
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 +16 -16
- package/tools/bootstrap-chain-reflective.js +98 -34
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/vats",
|
|
3
|
-
"version": "0.15.2-dev-
|
|
3
|
+
"version": "0.15.2-dev-f212cfd.0.f212cfd",
|
|
4
4
|
"description": "Agoric's Vat library",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -22,19 +22,19 @@
|
|
|
22
22
|
"author": "Agoric",
|
|
23
23
|
"license": "Apache-2.0",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@agoric/cosmic-proto": "0.4.1-dev-
|
|
26
|
-
"@agoric/ertp": "0.16.3-dev-
|
|
27
|
-
"@agoric/governance": "0.10.4-dev-
|
|
28
|
-
"@agoric/internal": "0.3.3-dev-
|
|
29
|
-
"@agoric/network": "0.1.1-dev-
|
|
30
|
-
"@agoric/notifier": "0.6.3-dev-
|
|
31
|
-
"@agoric/store": "0.9.3-dev-
|
|
32
|
-
"@agoric/swingset-vat": "0.32.3-dev-
|
|
33
|
-
"@agoric/time": "0.3.3-dev-
|
|
34
|
-
"@agoric/vat-data": "0.5.3-dev-
|
|
35
|
-
"@agoric/vow": "0.1.1-dev-
|
|
36
|
-
"@agoric/zoe": "0.26.3-dev-
|
|
37
|
-
"@agoric/zone": "0.2.3-dev-
|
|
25
|
+
"@agoric/cosmic-proto": "0.4.1-dev-f212cfd.0.f212cfd",
|
|
26
|
+
"@agoric/ertp": "0.16.3-dev-f212cfd.0.f212cfd",
|
|
27
|
+
"@agoric/governance": "0.10.4-dev-f212cfd.0.f212cfd",
|
|
28
|
+
"@agoric/internal": "0.3.3-dev-f212cfd.0.f212cfd",
|
|
29
|
+
"@agoric/network": "0.1.1-dev-f212cfd.0.f212cfd",
|
|
30
|
+
"@agoric/notifier": "0.6.3-dev-f212cfd.0.f212cfd",
|
|
31
|
+
"@agoric/store": "0.9.3-dev-f212cfd.0.f212cfd",
|
|
32
|
+
"@agoric/swingset-vat": "0.32.3-dev-f212cfd.0.f212cfd",
|
|
33
|
+
"@agoric/time": "0.3.3-dev-f212cfd.0.f212cfd",
|
|
34
|
+
"@agoric/vat-data": "0.5.3-dev-f212cfd.0.f212cfd",
|
|
35
|
+
"@agoric/vow": "0.1.1-dev-f212cfd.0.f212cfd",
|
|
36
|
+
"@agoric/zoe": "0.26.3-dev-f212cfd.0.f212cfd",
|
|
37
|
+
"@agoric/zone": "0.2.3-dev-f212cfd.0.f212cfd",
|
|
38
38
|
"@endo/errors": "^1.2.13",
|
|
39
39
|
"@endo/far": "^1.1.14",
|
|
40
40
|
"@endo/import-bundle": "^1.5.2",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"jessie.js": "^0.3.4"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@agoric/swingset-liveslots": "0.10.3-dev-
|
|
50
|
+
"@agoric/swingset-liveslots": "0.10.3-dev-f212cfd.0.f212cfd",
|
|
51
51
|
"@endo/bundle-source": "^4.1.2",
|
|
52
52
|
"@endo/init": "^1.1.12",
|
|
53
53
|
"ava": "^5.3.0",
|
|
@@ -79,5 +79,5 @@
|
|
|
79
79
|
"typeCoverage": {
|
|
80
80
|
"atLeast": 90.22
|
|
81
81
|
},
|
|
82
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "f212cfdd1987748d593ba731f0a9e837065ce0a6"
|
|
83
83
|
}
|
|
@@ -116,6 +116,63 @@ export const buildRootObject = (vatPowers, bootstrapParameters, baggage) => {
|
|
|
116
116
|
|
|
117
117
|
const reflectionMethods = makeReflectionMethods(vatPowers, baggage);
|
|
118
118
|
|
|
119
|
+
/**
|
|
120
|
+
* @param {string} bundleIdOrName
|
|
121
|
+
* @returns {Promise<import('@agoric/swingset-vat').BundleCap>}
|
|
122
|
+
*/
|
|
123
|
+
const getBundleCapByIdOrName = bundleIdOrName =>
|
|
124
|
+
bundleIdOrName.startsWith('b1-')
|
|
125
|
+
? E(vatAdminP).getBundleCap(bundleIdOrName)
|
|
126
|
+
: E(vatAdminP).getNamedBundleCap(bundleIdOrName);
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* @template BundleIdentifier
|
|
130
|
+
* @callback CreateVat
|
|
131
|
+
* @param {string} vatName
|
|
132
|
+
* @param {BundleIdentifier} bundleIdentifier
|
|
133
|
+
* @param {{ vatParameters?: object } & Record<string, unknown>} [vatOptions]
|
|
134
|
+
* @returns {Promise<DynamicVatRecord['root']>} root object of the new vat
|
|
135
|
+
*/
|
|
136
|
+
|
|
137
|
+
/** @type {CreateVat<import('@agoric/swingset-vat').BundleCap>} */
|
|
138
|
+
const createVat = async (vatName, bundleCap, vatOptions = {}) => {
|
|
139
|
+
const { root, adminNode } = await E(vatAdminP).createVat(bundleCap, {
|
|
140
|
+
vatParameters: {},
|
|
141
|
+
...vatOptions,
|
|
142
|
+
});
|
|
143
|
+
vatRecords.set(vatName, { root, adminNode, bundleCap });
|
|
144
|
+
return root;
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* @template BundleIdentifier
|
|
149
|
+
* @callback UpgradeVat
|
|
150
|
+
* @param {string} vatName
|
|
151
|
+
* @param {BundleIdentifier} bundleIdentifier
|
|
152
|
+
* @param {{ vatParameters?: object } & Record<string, unknown>} [vatOptions]
|
|
153
|
+
* @returns {Promise<number>} the resulting incarnation number
|
|
154
|
+
*/
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* @type {UpgradeVat<
|
|
158
|
+
* import('@agoric/swingset-vat').BundleCap | undefined
|
|
159
|
+
* >}
|
|
160
|
+
*/
|
|
161
|
+
const upgradeVat = async (vatName, bundleCap, vatOptions = {}) => {
|
|
162
|
+
const vatRecord = /** @type {DynamicVatRecord} */ (
|
|
163
|
+
vatRecords.get(vatName) || Fail`unknown vat name: ${q(vatName)}`
|
|
164
|
+
);
|
|
165
|
+
vatRecord.adminNode ||
|
|
166
|
+
Fail`no adminNode for vat ${q(vatName)}; is it static?`;
|
|
167
|
+
const upgradeOptions = { vatParameters: {}, ...vatOptions };
|
|
168
|
+
const { incarnationNumber } = await E(vatRecord.adminNode).upgrade(
|
|
169
|
+
bundleCap || vatRecord.bundleCap,
|
|
170
|
+
upgradeOptions,
|
|
171
|
+
);
|
|
172
|
+
vatRecord.incarnationNumber = incarnationNumber;
|
|
173
|
+
return incarnationNumber;
|
|
174
|
+
};
|
|
175
|
+
|
|
119
176
|
return Far('root', {
|
|
120
177
|
...reflectionMethods,
|
|
121
178
|
|
|
@@ -157,42 +214,49 @@ export const buildRootObject = (vatPowers, bootstrapParameters, baggage) => {
|
|
|
157
214
|
return root;
|
|
158
215
|
},
|
|
159
216
|
|
|
160
|
-
/**
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
return
|
|
217
|
+
/** @type {CreateVat<string>} */
|
|
218
|
+
createVatByBundleID: async (vatName, bundleID, vatOptions) => {
|
|
219
|
+
const bundleCap = await E(vatAdminP).getBundleCap(bundleID);
|
|
220
|
+
return createVat(vatName, bundleCap, vatOptions);
|
|
221
|
+
},
|
|
222
|
+
|
|
223
|
+
/** @type {CreateVat<string | undefined>} */
|
|
224
|
+
createVatByBundleName: async (
|
|
225
|
+
vatName,
|
|
226
|
+
bundleName = vatName,
|
|
227
|
+
vatOptions,
|
|
228
|
+
) => {
|
|
229
|
+
const bundleCap = await E(vatAdminP).getNamedBundleCap(bundleName);
|
|
230
|
+
return createVat(vatName, bundleCap, vatOptions);
|
|
231
|
+
},
|
|
232
|
+
|
|
233
|
+
/** @type {CreateVat<string | undefined>} */
|
|
234
|
+
createVat: async (vatName, bundleIdOrName = vatName, vatOptions) => {
|
|
235
|
+
const bundleCap = await getBundleCapByIdOrName(bundleIdOrName);
|
|
236
|
+
return createVat(vatName, bundleCap, vatOptions);
|
|
237
|
+
},
|
|
238
|
+
|
|
239
|
+
/** @type {UpgradeVat<string | undefined>} */
|
|
240
|
+
upgradeVatByBundleID: async (vatName, bundleID, vatOptions) => {
|
|
241
|
+
vatRecords.has(vatName) || Fail`unknown vat name: ${q(vatName)}`;
|
|
242
|
+
const bundleCap = await (bundleID && E(vatAdminP).getBundleCap(bundleID));
|
|
243
|
+
return upgradeVat(vatName, bundleCap, vatOptions);
|
|
244
|
+
},
|
|
245
|
+
|
|
246
|
+
/** @type {UpgradeVat<string | undefined>} */
|
|
247
|
+
upgradeVatByBundleName: async (vatName, bundleName, vatOptions) => {
|
|
248
|
+
vatRecords.has(vatName) || Fail`unknown vat name: ${q(vatName)}`;
|
|
249
|
+
const bundleCap = await (bundleName &&
|
|
250
|
+
E(vatAdminP).getNamedBundleCap(bundleName));
|
|
251
|
+
return upgradeVat(vatName, bundleCap, vatOptions);
|
|
174
252
|
},
|
|
175
253
|
|
|
176
|
-
/**
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
upgradeVat: async (vatName, bundleCapName, vatOptions = {}) => {
|
|
183
|
-
const vatRecord = /** @type {DynamicVatRecord} */ (
|
|
184
|
-
vatRecords.get(vatName) || Fail`unknown vat name: ${q(vatName)}`
|
|
185
|
-
);
|
|
186
|
-
const bundleCap = await (bundleCapName
|
|
187
|
-
? E(vatAdminP).getNamedBundleCap(bundleCapName)
|
|
188
|
-
: vatRecord.bundleCap);
|
|
189
|
-
const upgradeOptions = { vatParameters: {}, ...vatOptions };
|
|
190
|
-
const { incarnationNumber } = await E(vatRecord.adminNode).upgrade(
|
|
191
|
-
bundleCap,
|
|
192
|
-
upgradeOptions,
|
|
193
|
-
);
|
|
194
|
-
vatRecord.incarnationNumber = incarnationNumber;
|
|
195
|
-
return incarnationNumber;
|
|
254
|
+
/** @type {UpgradeVat<string | undefined>} */
|
|
255
|
+
upgradeVat: async (vatName, bundleIdOrName, vatOptions) => {
|
|
256
|
+
vatRecords.has(vatName) || Fail`unknown vat name: ${q(vatName)}`;
|
|
257
|
+
const bundleCap = await (bundleIdOrName &&
|
|
258
|
+
getBundleCapByIdOrName(bundleIdOrName));
|
|
259
|
+
return upgradeVat(vatName, bundleCap, vatOptions);
|
|
196
260
|
},
|
|
197
261
|
});
|
|
198
262
|
};
|