@agoric/zoe 0.26.3-dev-a035a67.0 → 0.26.3-dev-3190128.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/bundles/bundle-contractFacet-js-meta.json +94 -94
- package/bundles/bundle-contractFacet.js +1 -1
- package/package.json +14 -14
- package/tools/fakeVatAdmin.d.ts +9 -2
- package/tools/fakeVatAdmin.d.ts.map +1 -1
- package/tools/fakeVatAdmin.js +18 -10
- package/tools/setup-zoe.d.ts +7 -3
- package/tools/setup-zoe.d.ts.map +1 -1
- package/tools/setup-zoe.js +34 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/zoe",
|
|
3
|
-
"version": "0.26.3-dev-
|
|
3
|
+
"version": "0.26.3-dev-3190128.0+3190128",
|
|
4
4
|
"description": "Zoe: the Smart Contract Framework for Offer Enforcement",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/zoeService/zoe.js",
|
|
@@ -43,17 +43,17 @@
|
|
|
43
43
|
},
|
|
44
44
|
"homepage": "https://github.com/Agoric/agoric-sdk#readme",
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@agoric/base-zone": "0.1.1-dev-
|
|
47
|
-
"@agoric/ertp": "0.16.3-dev-
|
|
48
|
-
"@agoric/internal": "0.3.3-dev-
|
|
49
|
-
"@agoric/notifier": "0.6.3-dev-
|
|
50
|
-
"@agoric/store": "0.9.3-dev-
|
|
51
|
-
"@agoric/swingset-liveslots": "0.10.3-dev-
|
|
52
|
-
"@agoric/swingset-vat": "0.32.3-dev-
|
|
53
|
-
"@agoric/time": "0.3.3-dev-
|
|
54
|
-
"@agoric/vat-data": "0.5.3-dev-
|
|
55
|
-
"@agoric/vow": "0.1.1-dev-
|
|
56
|
-
"@agoric/zone": "0.2.3-dev-
|
|
46
|
+
"@agoric/base-zone": "0.1.1-dev-3190128.0+3190128",
|
|
47
|
+
"@agoric/ertp": "0.16.3-dev-3190128.0+3190128",
|
|
48
|
+
"@agoric/internal": "0.3.3-dev-3190128.0+3190128",
|
|
49
|
+
"@agoric/notifier": "0.6.3-dev-3190128.0+3190128",
|
|
50
|
+
"@agoric/store": "0.9.3-dev-3190128.0+3190128",
|
|
51
|
+
"@agoric/swingset-liveslots": "0.10.3-dev-3190128.0+3190128",
|
|
52
|
+
"@agoric/swingset-vat": "0.32.3-dev-3190128.0+3190128",
|
|
53
|
+
"@agoric/time": "0.3.3-dev-3190128.0+3190128",
|
|
54
|
+
"@agoric/vat-data": "0.5.3-dev-3190128.0+3190128",
|
|
55
|
+
"@agoric/vow": "0.1.1-dev-3190128.0+3190128",
|
|
56
|
+
"@agoric/zone": "0.2.3-dev-3190128.0+3190128",
|
|
57
57
|
"@endo/bundle-source": "^4.0.0",
|
|
58
58
|
"@endo/captp": "^4.4.5",
|
|
59
59
|
"@endo/common": "^1.2.10",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"yargs-parser": "^21.1.1"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
|
-
"@agoric/kmarshal": "0.1.1-dev-
|
|
73
|
+
"@agoric/kmarshal": "0.1.1-dev-3190128.0+3190128",
|
|
74
74
|
"@endo/init": "^1.1.9",
|
|
75
75
|
"ava": "^5.3.0",
|
|
76
76
|
"c8": "^10.1.2",
|
|
@@ -100,5 +100,5 @@
|
|
|
100
100
|
"typeCoverage": {
|
|
101
101
|
"atLeast": 85.15
|
|
102
102
|
},
|
|
103
|
-
"gitHead": "
|
|
103
|
+
"gitHead": "319012817be4498d42ea95c0f8460e1edb2ecb9c"
|
|
104
104
|
}
|
package/tools/fakeVatAdmin.d.ts
CHANGED
|
@@ -88,15 +88,22 @@ export function makeFakeVatAdmin(testContextSetter?: (...args: any) => unknown,
|
|
|
88
88
|
getExitMessage: () => any;
|
|
89
89
|
getHasExited: () => boolean;
|
|
90
90
|
getExitWithFailure: () => any;
|
|
91
|
-
|
|
91
|
+
/**
|
|
92
|
+
* @param {string} id
|
|
93
|
+
* @param {EndoZipBase64Bundle | TestBundle} bundle
|
|
94
|
+
*/
|
|
95
|
+
installBundle: (id: string, bundle: EndoZipBase64Bundle | TestBundle) => any;
|
|
92
96
|
installNamedBundle: (name: any, id: any, bundle: any) => any;
|
|
93
97
|
getCriticalVatKey: () => {};
|
|
94
98
|
getVatPowers: () => {
|
|
95
99
|
D: (bcap: any) => {
|
|
96
|
-
getBundle: () => EndoZipBase64Bundle
|
|
100
|
+
getBundle: () => EndoZipBase64Bundle | {
|
|
101
|
+
moduleFormat: "test";
|
|
102
|
+
} | undefined;
|
|
97
103
|
};
|
|
98
104
|
};
|
|
99
105
|
};
|
|
100
106
|
};
|
|
101
107
|
import type { EndoZipBase64Bundle } from '@agoric/swingset-vat';
|
|
108
|
+
import type { TestBundle } from '@agoric/swingset-vat';
|
|
102
109
|
//# sourceMappingURL=fakeVatAdmin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fakeVatAdmin.d.ts","sourceRoot":"","sources":["fakeVatAdmin.js"],"names":[],"mappings":"AAyBA,+BAA4C;;wBAJ7B,OAAO,sBAAsB,EAAE,SAAS;
|
|
1
|
+
{"version":3,"file":"fakeVatAdmin.d.ts","sourceRoot":"","sources":["fakeVatAdmin.js"],"names":[],"mappings":"AAyBA,+BAA4C;;wBAJ7B,OAAO,sBAAsB,EAAE,SAAS;AA4JvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA8C;AAtJ9C;;;GAGG;AACH,qDAHW,CAAC,GAAG,IAAI,KAAA,KAAK,OAAO,eACpB,CAAC,CAAC,EAAE,OAAO,KAAK,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAgH9B;;;WAGG;4BAFQ,MAAM,UACN,mBAAmB,GAAG,UAAU;;;;;;kCAxGkB,MAAM;;;;;EAmItE;yCAzJ2D,sBAAsB;gCAAtB,sBAAsB"}
|
package/tools/fakeVatAdmin.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
//
|
|
1
|
+
// no jessie-check because this code runs only in Node for testing
|
|
2
|
+
/* eslint-env node */
|
|
2
3
|
|
|
3
4
|
import { Fail } from '@endo/errors';
|
|
4
5
|
import { E } from '@endo/eventual-send';
|
|
@@ -13,9 +14,8 @@ import { makeHandle } from '../src/makeHandle.js';
|
|
|
13
14
|
import zcfBundle from '../bundles/bundle-contractFacet.js';
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
|
-
* @import {LegacyWeakMap, WeakMapStore} from '@agoric/store';
|
|
17
17
|
* @import {MapStore} from '@agoric/swingset-liveslots';
|
|
18
|
-
* @import {BundleID, EndoZipBase64Bundle} from '@agoric/swingset-vat';
|
|
18
|
+
* @import {BundleID, EndoZipBase64Bundle, TestBundle} from '@agoric/swingset-vat';
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
21
|
// this simulates a bundlecap, which is normally a swingset "device node"
|
|
@@ -37,8 +37,8 @@ function makeFakeVatAdmin(testContextSetter = undefined, makeRemote = x => x) {
|
|
|
37
37
|
let exitWithFailure;
|
|
38
38
|
/** @type {MapStore<BundleID, BundleCap>} */
|
|
39
39
|
const idToBundleCap = makeScalarMapStore('idToBundleCap');
|
|
40
|
-
/** @type {
|
|
41
|
-
const bundleCapToBundle =
|
|
40
|
+
/** @type {Map<BundleCap, EndoZipBase64Bundle | {moduleFormat: 'test'}>} */
|
|
41
|
+
const bundleCapToBundle = new Map();
|
|
42
42
|
/** @type {MapStore<string, BundleID>} */
|
|
43
43
|
const nameToBundleID = makeScalarMapStore('nameToBundleID');
|
|
44
44
|
const fakeVatPowers = {
|
|
@@ -139,17 +139,25 @@ function makeFakeVatAdmin(testContextSetter = undefined, makeRemote = x => x) {
|
|
|
139
139
|
getExitMessage: () => exitMessage,
|
|
140
140
|
getHasExited: () => hasExited,
|
|
141
141
|
getExitWithFailure: () => exitWithFailure,
|
|
142
|
+
/**
|
|
143
|
+
* @param {string} id
|
|
144
|
+
* @param {EndoZipBase64Bundle | TestBundle} bundle
|
|
145
|
+
*/
|
|
142
146
|
installBundle: (id, bundle) => {
|
|
143
147
|
if (idToBundleCap.has(id)) {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
)
|
|
148
|
+
const extant = bundleCapToBundle.get(idToBundleCap.get(id));
|
|
149
|
+
assert(extant);
|
|
150
|
+
assert.equal(bundle.moduleFormat, extant.moduleFormat);
|
|
151
|
+
if (extant.moduleFormat === 'endoZipBase64') {
|
|
152
|
+
// Narrow bundle.moduleFormat now that extant.moduleFormat is narrowed
|
|
153
|
+
assert.equal(bundle.moduleFormat, extant.moduleFormat);
|
|
154
|
+
assert.equal(bundle.endoZipBase64, extant.endoZipBase64);
|
|
155
|
+
}
|
|
148
156
|
return idToBundleCap.get(id);
|
|
149
157
|
}
|
|
150
158
|
const bundleCap = fakeBundleCap();
|
|
151
159
|
idToBundleCap.init(id, bundleCap);
|
|
152
|
-
bundleCapToBundle.
|
|
160
|
+
bundleCapToBundle.set(bundleCap, bundle);
|
|
153
161
|
return bundleCap;
|
|
154
162
|
},
|
|
155
163
|
installNamedBundle: (name, id, bundle) => {
|
package/tools/setup-zoe.d.ts
CHANGED
|
@@ -15,22 +15,26 @@ export function setUpZoeForTest<T extends unknown = any>({ setJig, feeIssuerConf
|
|
|
15
15
|
}): Promise<{
|
|
16
16
|
zoe: import("@endo/exo").Guarded<globalThis.ZoeService>;
|
|
17
17
|
feeMintAccessP: FeeMintAccess;
|
|
18
|
-
bundleAndInstall: (
|
|
18
|
+
bundleAndInstall: (pathOrExports: object) => Promise<Installation>;
|
|
19
19
|
vatAdminSvc: VatAdminSvc;
|
|
20
20
|
vatAdminState: {
|
|
21
21
|
getExitMessage: () => any;
|
|
22
22
|
getHasExited: () => boolean;
|
|
23
23
|
getExitWithFailure: () => any;
|
|
24
|
-
installBundle: (id:
|
|
24
|
+
installBundle: (id: string, bundle: EndoZipBase64Bundle | TestBundle) => any;
|
|
25
25
|
installNamedBundle: (name: any, id: any, bundle: any) => any;
|
|
26
26
|
getCriticalVatKey: () => {};
|
|
27
27
|
getVatPowers: () => {
|
|
28
28
|
D: (bcap: any) => {
|
|
29
|
-
getBundle: () => EndoZipBase64Bundle
|
|
29
|
+
getBundle: () => EndoZipBase64Bundle | {
|
|
30
|
+
moduleFormat: "test";
|
|
31
|
+
} | undefined;
|
|
30
32
|
};
|
|
31
33
|
};
|
|
32
34
|
} | undefined;
|
|
33
35
|
}>;
|
|
34
36
|
import type { FeeIssuerConfig } from '../src/types-index.js';
|
|
35
37
|
import type { Installation } from '../src/types-index.js';
|
|
38
|
+
import type { EndoZipBase64Bundle } from '@agoric/swingset-vat';
|
|
39
|
+
import type { TestBundle } from '@agoric/swingset-vat';
|
|
36
40
|
//# sourceMappingURL=setup-zoe.d.ts.map
|
package/tools/setup-zoe.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup-zoe.d.ts","sourceRoot":"","sources":["setup-zoe.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"setup-zoe.d.ts","sourceRoot":"","sources":["setup-zoe.js"],"names":[],"mappings":"AAgBO,gDAFI,WAAW;;;;;;;EAOrB;AAKM,6CAFI,WAAW,sDAGqB;AAapC,gCAPgB,CAAC,mFAErB;IAAmC,MAAM,UAA3B,CAAC,KAAK,IAAI;IACU,eAAe;IACnB,WAAW;IACf,aAAa;CAAC;;;sCAmD9B,MAAM,KACJ,OAAO,CAAC,YAAY,CAAC;;;;;;;;;;;;;;;;;GAoBnC;qCApG+C,uBAAuB;kCAAvB,uBAAuB;yCADrB,sBAAsB;gCAAtB,sBAAsB"}
|
package/tools/setup-zoe.js
CHANGED
|
@@ -2,10 +2,12 @@ import { E, makeLoopback } from '@endo/captp';
|
|
|
2
2
|
|
|
3
3
|
import { makeScalarBigMapStore } from '@agoric/vat-data';
|
|
4
4
|
import bundleSource from '@endo/bundle-source';
|
|
5
|
+
import { bundleTestExports } from '@endo/import-bundle';
|
|
5
6
|
import { makeDurableZoeKit } from '../src/zoeService/zoe.js';
|
|
6
7
|
import fakeVatAdmin, { makeFakeVatAdmin } from './fakeVatAdmin.js';
|
|
7
8
|
|
|
8
9
|
/**
|
|
10
|
+
* @import {EndoZipBase64Bundle, TestBundle} from '@agoric/swingset-vat';
|
|
9
11
|
* @import {FeeIssuerConfig, Installation} from '../src/types-index.js';
|
|
10
12
|
*/
|
|
11
13
|
|
|
@@ -61,13 +63,40 @@ export const setUpZoeForTest = async ({
|
|
|
61
63
|
);
|
|
62
64
|
|
|
63
65
|
/**
|
|
64
|
-
* @param {
|
|
66
|
+
* @param {object} pathOrExports
|
|
67
|
+
* @returns {Promise<EndoZipBase64Bundle | TestBundle>}
|
|
68
|
+
*/
|
|
69
|
+
const bundleModule = async pathOrExports => {
|
|
70
|
+
if (typeof pathOrExports === 'string') {
|
|
71
|
+
const path = pathOrExports;
|
|
72
|
+
return bundleSource(path);
|
|
73
|
+
} else {
|
|
74
|
+
assert.equal(
|
|
75
|
+
Object.getOwnPropertyDescriptor(pathOrExports, Symbol.toStringTag)
|
|
76
|
+
?.value,
|
|
77
|
+
'Module',
|
|
78
|
+
);
|
|
79
|
+
// Copy all the properties so this object can be hardened.
|
|
80
|
+
const exports = { ...pathOrExports };
|
|
81
|
+
return bundleTestExports(exports);
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Bundle the source module (either as file system path or a Module object)
|
|
87
|
+
* and return an Installation. The bundleID is random and should not be relied
|
|
88
|
+
* upon in tests of this variety.
|
|
89
|
+
*
|
|
90
|
+
* @param {object} pathOrExports
|
|
65
91
|
* @returns {Promise<Installation>}
|
|
66
92
|
*/
|
|
67
|
-
const bundleAndInstall = async
|
|
68
|
-
const bundle = await
|
|
69
|
-
|
|
70
|
-
|
|
93
|
+
const bundleAndInstall = async pathOrExports => {
|
|
94
|
+
const bundle = await bundleModule(pathOrExports);
|
|
95
|
+
assert(
|
|
96
|
+
vatAdminState,
|
|
97
|
+
'bundleAndInstall called before vatAdminState defined',
|
|
98
|
+
);
|
|
99
|
+
const id = `b1-zoe-test-${Math.random()}`;
|
|
71
100
|
vatAdminState.installBundle(id, bundle);
|
|
72
101
|
return E(zoeService).installBundleID(id);
|
|
73
102
|
};
|