@agoric/zoe 0.26.3-dev-5ec590e.0.5ec590e → 0.26.3-dev-d1bb9cd.0.d1bb9cd
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 +14 -14
- package/src/contractFacet/buildRootObject.d.ts +14 -0
- package/src/contractFacet/buildRootObject.d.ts.map +1 -0
- package/src/contractFacet/buildRootObject.js +89 -0
- package/src/contractFacet/vatRoot.d.ts +5 -28
- package/src/contractFacet/vatRoot.d.ts.map +1 -1
- package/src/contractFacet/vatRoot.js +2 -79
- package/tools/fakeVatAdmin.d.ts +12 -56
- package/tools/fakeVatAdmin.d.ts.map +1 -1
- package/tools/fakeVatAdmin.js +19 -12
- package/tools/setup-zoe.d.ts +1 -0
- package/tools/setup-zoe.d.ts.map +1 -1
- package/tools/testVatRoot.d.ts +7 -0
- package/tools/testVatRoot.d.ts.map +1 -0
- package/tools/testVatRoot.js +7 -0
- package/source-spec-registry.d.ts +0 -25
- package/source-spec-registry.d.ts.map +0 -1
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-d1bb9cd.0.d1bb9cd",
|
|
4
4
|
"description": "Zoe: the Smart Contract Framework for Offer Enforcement",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/zoeService/zoe.js",
|
|
@@ -40,17 +40,17 @@
|
|
|
40
40
|
},
|
|
41
41
|
"homepage": "https://github.com/Agoric/agoric-sdk#readme",
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@agoric/base-zone": "0.1.1-dev-
|
|
44
|
-
"@agoric/ertp": "0.16.3-dev-
|
|
45
|
-
"@agoric/internal": "0.3.3-dev-
|
|
46
|
-
"@agoric/notifier": "0.6.3-dev-
|
|
47
|
-
"@agoric/store": "0.9.3-dev-
|
|
48
|
-
"@agoric/swingset-liveslots": "0.10.3-dev-
|
|
49
|
-
"@agoric/swingset-vat": "0.32.3-dev-
|
|
50
|
-
"@agoric/time": "0.3.3-dev-
|
|
51
|
-
"@agoric/vat-data": "0.5.3-dev-
|
|
52
|
-
"@agoric/vow": "0.1.1-dev-
|
|
53
|
-
"@agoric/zone": "0.2.3-dev-
|
|
43
|
+
"@agoric/base-zone": "0.1.1-dev-d1bb9cd.0.d1bb9cd",
|
|
44
|
+
"@agoric/ertp": "0.16.3-dev-d1bb9cd.0.d1bb9cd",
|
|
45
|
+
"@agoric/internal": "0.3.3-dev-d1bb9cd.0.d1bb9cd",
|
|
46
|
+
"@agoric/notifier": "0.6.3-dev-d1bb9cd.0.d1bb9cd",
|
|
47
|
+
"@agoric/store": "0.9.3-dev-d1bb9cd.0.d1bb9cd",
|
|
48
|
+
"@agoric/swingset-liveslots": "0.10.3-dev-d1bb9cd.0.d1bb9cd",
|
|
49
|
+
"@agoric/swingset-vat": "0.32.3-dev-d1bb9cd.0.d1bb9cd",
|
|
50
|
+
"@agoric/time": "0.3.3-dev-d1bb9cd.0.d1bb9cd",
|
|
51
|
+
"@agoric/vat-data": "0.5.3-dev-d1bb9cd.0.d1bb9cd",
|
|
52
|
+
"@agoric/vow": "0.1.1-dev-d1bb9cd.0.d1bb9cd",
|
|
53
|
+
"@agoric/zone": "0.2.3-dev-d1bb9cd.0.d1bb9cd",
|
|
54
54
|
"@endo/bundle-source": "^4.1.2",
|
|
55
55
|
"@endo/captp": "^4.4.8",
|
|
56
56
|
"@endo/common": "^1.2.13",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"yargs-parser": "^21.1.1"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
|
-
"@agoric/kmarshal": "0.1.1-dev-
|
|
70
|
+
"@agoric/kmarshal": "0.1.1-dev-d1bb9cd.0.d1bb9cd",
|
|
71
71
|
"@endo/init": "^1.1.12",
|
|
72
72
|
"ava": "^6.4.1",
|
|
73
73
|
"c8": "^10.1.3",
|
|
@@ -97,5 +97,5 @@
|
|
|
97
97
|
"typeCoverage": {
|
|
98
98
|
"atLeast": 84.84
|
|
99
99
|
},
|
|
100
|
-
"gitHead": "
|
|
100
|
+
"gitHead": "d1bb9cd8ec3f764f64cda4b331c66e37ad179a73"
|
|
101
101
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export function makeBuildRootObject(makeZCFZygote: (powers: any, zoeService: ZoeService, invitationIssuer: Issuer<"set">, testJigSetter: ({ zcf }: {
|
|
2
|
+
zcf: ZCF;
|
|
3
|
+
}) => void, contractBundleCap: BundleCap, baggage: Baggage) => Promise<any>): (powers: any, vatParameters: {
|
|
4
|
+
contractBundleCap: BundleCap;
|
|
5
|
+
zoeService: ZoeService;
|
|
6
|
+
invitationIssuer: Issuer<"set">;
|
|
7
|
+
privateArgs?: any;
|
|
8
|
+
}, baggage: Baggage) => Promise<import("@endo/marshal").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {}>>;
|
|
9
|
+
import type { ZoeService } from '@agoric/zoe';
|
|
10
|
+
import type { Issuer } from '@agoric/ertp';
|
|
11
|
+
import type { ZCF } from '@agoric/zoe';
|
|
12
|
+
import type { BundleCap } from '@agoric/swingset-vat';
|
|
13
|
+
import type { Baggage } from '@agoric/vat-data';
|
|
14
|
+
//# sourceMappingURL=buildRootObject.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildRootObject.d.ts","sourceRoot":"","sources":["buildRootObject.js"],"names":[],"mappings":"AAqBO,mDAJI,CAAC,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,UAAU,EAAE,gBAAgB,EAAE,OAAO,KAAK,CAAC,EAC3E,aAAa,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE;IAAE,GAAG,EAAE,GAAG,CAAA;CAAE,KAAK,IAAI,EAC9C,iBAAiB,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,GAAG,CAAC,YAIvD,GAAG,iBACH;IACN,iBAAiB,EAAE,SAAS,CAAC;IAC7B,UAAU,EAAE,UAAU,CAAC;IACvB,gBAAgB,EAAE,OAAO,KAAK,CAAC,CAAC;IAChC,WAAW,CAAC,EAAE,GAAG,CAAC;CACnB,WACO,OAAO,mIAyDnB;gCAhFiC,aAAa;4BAGtB,cAAc;yBAHL,aAAa;+BAEnB,sBAAsB;6BADxB,kBAAkB"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// @jessie-check
|
|
2
|
+
|
|
3
|
+
import { Fail } from '@endo/errors';
|
|
4
|
+
import { E } from '@endo/far';
|
|
5
|
+
import { Far } from '@endo/marshal';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @import {ZCF, ZoeService} from '@agoric/zoe';
|
|
9
|
+
* @import {Baggage} from '@agoric/vat-data';
|
|
10
|
+
* @import {BundleCap} from '@agoric/swingset-vat';
|
|
11
|
+
* @import {Issuer} from '@agoric/ertp';
|
|
12
|
+
* @import {StartZcf} from '../internal-types.js';
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Shared implementation for production and test contract-vat roots.
|
|
17
|
+
*
|
|
18
|
+
* @param {(powers: any, zoeService: ZoeService, invitationIssuer: Issuer<'set'>,
|
|
19
|
+
* testJigSetter: ({ zcf }: { zcf: ZCF }) => void,
|
|
20
|
+
* contractBundleCap: BundleCap, baggage: Baggage) => Promise<any>} makeZCFZygote
|
|
21
|
+
*/
|
|
22
|
+
export const makeBuildRootObject = makeZCFZygote => {
|
|
23
|
+
/**
|
|
24
|
+
* @param {any} powers
|
|
25
|
+
* @param {{
|
|
26
|
+
* contractBundleCap: BundleCap,
|
|
27
|
+
* zoeService: ZoeService,
|
|
28
|
+
* invitationIssuer: Issuer<'set'>,
|
|
29
|
+
* privateArgs?: any,
|
|
30
|
+
* }} vatParameters
|
|
31
|
+
* @param {Baggage} baggage
|
|
32
|
+
*/
|
|
33
|
+
const buildRootObject = async (powers, vatParameters, baggage) => {
|
|
34
|
+
const { testJigSetter } = powers;
|
|
35
|
+
const { contractBundleCap } = vatParameters;
|
|
36
|
+
contractBundleCap ||
|
|
37
|
+
Fail`expected vatParameters.contractBundleCap ${vatParameters}`;
|
|
38
|
+
let { zoeService, invitationIssuer } = vatParameters;
|
|
39
|
+
const firstTime = !baggage.has('DidStart');
|
|
40
|
+
if (firstTime) {
|
|
41
|
+
baggage.init('DidStart', 'DidStart');
|
|
42
|
+
baggage.init('zoeService', zoeService);
|
|
43
|
+
baggage.init('invitationIssuer', invitationIssuer);
|
|
44
|
+
} else {
|
|
45
|
+
!zoeService || Fail`On restart zoeService must not be in vatParameters`;
|
|
46
|
+
zoeService = baggage.get('zoeService');
|
|
47
|
+
|
|
48
|
+
!invitationIssuer ||
|
|
49
|
+
Fail`On restart invitationIssuer must not be in vatParameters`;
|
|
50
|
+
invitationIssuer = baggage.get('invitationIssuer');
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const zcfZygote = await makeZCFZygote(
|
|
54
|
+
powers,
|
|
55
|
+
zoeService,
|
|
56
|
+
invitationIssuer,
|
|
57
|
+
testJigSetter,
|
|
58
|
+
contractBundleCap,
|
|
59
|
+
baggage,
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
if (!firstTime) {
|
|
63
|
+
return E.when(
|
|
64
|
+
E(zcfZygote).restartContract(vatParameters.privateArgs),
|
|
65
|
+
() => Far('upgraded contractRunner', {}),
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return Far('contractRunner', {
|
|
70
|
+
/** @type {StartZcf} */
|
|
71
|
+
startZcf: (
|
|
72
|
+
zoeInstanceAdmin,
|
|
73
|
+
instanceRecordFromZoe,
|
|
74
|
+
issuerStorageFromZoe,
|
|
75
|
+
privateArgs = undefined,
|
|
76
|
+
) => {
|
|
77
|
+
return E(zcfZygote).startContract(
|
|
78
|
+
zoeInstanceAdmin,
|
|
79
|
+
instanceRecordFromZoe,
|
|
80
|
+
issuerStorageFromZoe,
|
|
81
|
+
privateArgs,
|
|
82
|
+
);
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
return harden(buildRootObject);
|
|
88
|
+
};
|
|
89
|
+
harden(makeBuildRootObject);
|
|
@@ -1,30 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* @import {BundleCap} from '@agoric/swingset-vat';
|
|
6
|
-
* @import {StartZcf} from '../internal-types.js';
|
|
7
|
-
* @import {Issuer} from '@agoric/ertp';
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* @param {VatPowers & { testJigSetter: ( {zcf}: {zcf: ZCF} ) => void }} powers
|
|
11
|
-
* @param {{contractBundleCap: BundleCap, zoeService: ZoeService, invitationIssuer: Issuer<'set'>, privateArgs?: any}} vatParameters
|
|
12
|
-
* @param {Baggage} baggage
|
|
13
|
-
*/
|
|
14
|
-
export function buildRootObject(powers: VatPowers & {
|
|
15
|
-
testJigSetter: ({ zcf }: {
|
|
16
|
-
zcf: ZCF;
|
|
17
|
-
}) => void;
|
|
18
|
-
}, vatParameters: {
|
|
19
|
-
contractBundleCap: BundleCap;
|
|
20
|
-
zoeService: ZoeService;
|
|
21
|
-
invitationIssuer: Issuer<"set">;
|
|
1
|
+
export const buildRootObject: (powers: any, vatParameters: {
|
|
2
|
+
contractBundleCap: import("@agoric/swingset-vat").BundleCap;
|
|
3
|
+
zoeService: import("../types-index.js").ZoeService;
|
|
4
|
+
invitationIssuer: import("@agoric/ertp").Issuer<"set">;
|
|
22
5
|
privateArgs?: any;
|
|
23
|
-
}, baggage: Baggage)
|
|
24
|
-
import type { VatPowers } from '@agoric/swingset-vat';
|
|
25
|
-
import type { ZCF } from '@agoric/zoe';
|
|
26
|
-
import type { BundleCap } from '@agoric/swingset-vat';
|
|
27
|
-
import type { ZoeService } from '@agoric/zoe';
|
|
28
|
-
import type { Issuer } from '@agoric/ertp';
|
|
29
|
-
import type { Baggage } from '@agoric/vat-data';
|
|
6
|
+
}, baggage: import("@agoric/vat-data").Baggage) => Promise<import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {}>>;
|
|
30
7
|
//# sourceMappingURL=vatRoot.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vatRoot.d.ts","sourceRoot":"","sources":["vatRoot.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vatRoot.d.ts","sourceRoot":"","sources":["vatRoot.js"],"names":[],"mappings":"AAUA;;;;eAG6R,CAAC;oLAH5N"}
|
|
@@ -5,86 +5,9 @@
|
|
|
5
5
|
// time this file is edited, the bundle must be manually rebuilt with
|
|
6
6
|
// `yarn build-zcfBundle`.
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
import { E } from '@endo/far';
|
|
10
|
-
import { Far } from '@endo/marshal';
|
|
11
|
-
|
|
8
|
+
import { makeBuildRootObject } from './buildRootObject.js';
|
|
12
9
|
import { makeZCFZygote } from './zcfZygote.js';
|
|
13
10
|
|
|
14
|
-
|
|
15
|
-
* @import {ZCF, ZoeService} from '@agoric/zoe';
|
|
16
|
-
* @import {Baggage} from '@agoric/vat-data';
|
|
17
|
-
* @import {VatPowers} from '@agoric/swingset-vat';
|
|
18
|
-
* @import {BundleCap} from '@agoric/swingset-vat';
|
|
19
|
-
* @import {StartZcf} from '../internal-types.js';
|
|
20
|
-
* @import {Issuer} from '@agoric/ertp';
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* @param {VatPowers & { testJigSetter: ( {zcf}: {zcf: ZCF} ) => void }} powers
|
|
25
|
-
* @param {{contractBundleCap: BundleCap, zoeService: ZoeService, invitationIssuer: Issuer<'set'>, privateArgs?: any}} vatParameters
|
|
26
|
-
* @param {Baggage} baggage
|
|
27
|
-
*/
|
|
28
|
-
export async function buildRootObject(powers, vatParameters, baggage) {
|
|
29
|
-
// Currently, there is only one function, `executeContract` called
|
|
30
|
-
// by the Zoe Service. However, when there is kernel support for
|
|
31
|
-
// zygote vats (essentially freezing and then creating copies of
|
|
32
|
-
// vats), `makeZCFZygote`, `zcfZygote.evaluateContract` and
|
|
33
|
-
// `zcfZygote.startContract` should exposed separately.
|
|
34
|
-
const { testJigSetter } = powers;
|
|
35
|
-
const { contractBundleCap } = vatParameters;
|
|
36
|
-
contractBundleCap ||
|
|
37
|
-
Fail`expected vatParameters.contractBundleCap ${vatParameters}`;
|
|
38
|
-
let { zoeService, invitationIssuer } = vatParameters;
|
|
39
|
-
const firstTime = !baggage.has('DidStart');
|
|
40
|
-
if (firstTime) {
|
|
41
|
-
baggage.init('DidStart', 'DidStart');
|
|
42
|
-
baggage.init('zoeService', zoeService);
|
|
43
|
-
baggage.init('invitationIssuer', invitationIssuer);
|
|
44
|
-
} else {
|
|
45
|
-
!zoeService || Fail`On restart zoeService must not be in vatParameters`;
|
|
46
|
-
zoeService = baggage.get('zoeService');
|
|
47
|
-
|
|
48
|
-
!invitationIssuer ||
|
|
49
|
-
Fail`On restart invitationIssuer must not be in vatParameters`;
|
|
50
|
-
invitationIssuer = baggage.get('invitationIssuer');
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// make zcfZygote with contract-general state and kinds initialized
|
|
54
|
-
const zcfZygote = await makeZCFZygote(
|
|
55
|
-
powers,
|
|
56
|
-
zoeService,
|
|
57
|
-
invitationIssuer,
|
|
58
|
-
testJigSetter,
|
|
59
|
-
contractBundleCap,
|
|
60
|
-
baggage,
|
|
61
|
-
);
|
|
62
|
-
|
|
63
|
-
// snapshot zygote here //////////////////
|
|
64
|
-
|
|
65
|
-
if (!firstTime) {
|
|
66
|
-
return E.when(E(zcfZygote).restartContract(vatParameters.privateArgs), () =>
|
|
67
|
-
Far('upgraded contractRunner', {}),
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return Far('contractRunner', {
|
|
72
|
-
// initialize instance-specific state of the contract
|
|
73
|
-
/** @type {StartZcf} */
|
|
74
|
-
startZcf: (
|
|
75
|
-
zoeInstanceAdmin,
|
|
76
|
-
instanceRecordFromZoe,
|
|
77
|
-
issuerStorageFromZoe,
|
|
78
|
-
privateArgs = undefined,
|
|
79
|
-
) => {
|
|
80
|
-
return E(zcfZygote).startContract(
|
|
81
|
-
zoeInstanceAdmin,
|
|
82
|
-
instanceRecordFromZoe,
|
|
83
|
-
issuerStorageFromZoe,
|
|
84
|
-
privateArgs,
|
|
85
|
-
);
|
|
86
|
-
},
|
|
87
|
-
});
|
|
88
|
-
}
|
|
11
|
+
export const buildRootObject = makeBuildRootObject(makeZCFZygote);
|
|
89
12
|
|
|
90
13
|
harden(buildRootObject);
|
package/tools/fakeVatAdmin.d.ts
CHANGED
|
@@ -5,39 +5,15 @@ declare const fakeVatAdmin: {
|
|
|
5
5
|
waitForBundleCap: (bundleID: any) => Promise<any>;
|
|
6
6
|
getNamedBundleCap: (name: any) => Promise<any>;
|
|
7
7
|
getBundleIDByName: (name: any) => Promise<string>;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}) => Promise<{
|
|
11
|
-
root: unknown;
|
|
12
|
-
adminNode: {
|
|
13
|
-
done: () => Promise<any>;
|
|
14
|
-
terminateWithFailure: () => void;
|
|
15
|
-
upgrade: (_bundleCap: any, _options: any) => never;
|
|
16
|
-
} & import("@endo/marshal").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
17
|
-
done: () => Promise<any>;
|
|
18
|
-
terminateWithFailure: () => void;
|
|
19
|
-
upgrade: (_bundleCap: any, _options: any) => never;
|
|
20
|
-
}>;
|
|
21
|
-
}>;
|
|
8
|
+
/** @type {(bundleCap: BundleCap, options?: Partial<DynamicVatOptions>) => Promise<CreateVatResults>} */
|
|
9
|
+
createVat: (bundleCap: BundleCap, options?: Partial<DynamicVatOptions>) => Promise<CreateVatResults>;
|
|
22
10
|
} & import("@endo/marshal").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
23
11
|
getBundleCap: (bundleID: any) => Promise<any>;
|
|
24
12
|
waitForBundleCap: (bundleID: any) => Promise<any>;
|
|
25
13
|
getNamedBundleCap: (name: any) => Promise<any>;
|
|
26
14
|
getBundleIDByName: (name: any) => Promise<string>;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}) => Promise<{
|
|
30
|
-
root: unknown;
|
|
31
|
-
adminNode: {
|
|
32
|
-
done: () => Promise<any>;
|
|
33
|
-
terminateWithFailure: () => void;
|
|
34
|
-
upgrade: (_bundleCap: any, _options: any) => never;
|
|
35
|
-
} & import("@endo/marshal").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
36
|
-
done: () => Promise<any>;
|
|
37
|
-
terminateWithFailure: () => void;
|
|
38
|
-
upgrade: (_bundleCap: any, _options: any) => never;
|
|
39
|
-
}>;
|
|
40
|
-
}>;
|
|
15
|
+
/** @type {(bundleCap: BundleCap, options?: Partial<DynamicVatOptions>) => Promise<CreateVatResults>} */
|
|
16
|
+
createVat: (bundleCap: BundleCap, options?: Partial<DynamicVatOptions>) => Promise<CreateVatResults>;
|
|
41
17
|
}>;
|
|
42
18
|
/**
|
|
43
19
|
* @param {(...args) => unknown} [testContextSetter]
|
|
@@ -49,39 +25,15 @@ export function makeFakeVatAdmin(testContextSetter?: (...args: any) => unknown,
|
|
|
49
25
|
waitForBundleCap: (bundleID: any) => Promise<any>;
|
|
50
26
|
getNamedBundleCap: (name: any) => Promise<any>;
|
|
51
27
|
getBundleIDByName: (name: any) => Promise<string>;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}) => Promise<{
|
|
55
|
-
root: unknown;
|
|
56
|
-
adminNode: {
|
|
57
|
-
done: () => Promise<any>;
|
|
58
|
-
terminateWithFailure: () => void;
|
|
59
|
-
upgrade: (_bundleCap: any, _options: any) => never;
|
|
60
|
-
} & import("@endo/marshal").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
61
|
-
done: () => Promise<any>;
|
|
62
|
-
terminateWithFailure: () => void;
|
|
63
|
-
upgrade: (_bundleCap: any, _options: any) => never;
|
|
64
|
-
}>;
|
|
65
|
-
}>;
|
|
28
|
+
/** @type {(bundleCap: BundleCap, options?: Partial<DynamicVatOptions>) => Promise<CreateVatResults>} */
|
|
29
|
+
createVat: (bundleCap: BundleCap, options?: Partial<DynamicVatOptions>) => Promise<CreateVatResults>;
|
|
66
30
|
} & import("@endo/marshal").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
67
31
|
getBundleCap: (bundleID: any) => Promise<any>;
|
|
68
32
|
waitForBundleCap: (bundleID: any) => Promise<any>;
|
|
69
33
|
getNamedBundleCap: (name: any) => Promise<any>;
|
|
70
34
|
getBundleIDByName: (name: any) => Promise<string>;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}) => Promise<{
|
|
74
|
-
root: unknown;
|
|
75
|
-
adminNode: {
|
|
76
|
-
done: () => Promise<any>;
|
|
77
|
-
terminateWithFailure: () => void;
|
|
78
|
-
upgrade: (_bundleCap: any, _options: any) => never;
|
|
79
|
-
} & import("@endo/marshal").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {
|
|
80
|
-
done: () => Promise<any>;
|
|
81
|
-
terminateWithFailure: () => void;
|
|
82
|
-
upgrade: (_bundleCap: any, _options: any) => never;
|
|
83
|
-
}>;
|
|
84
|
-
}>;
|
|
35
|
+
/** @type {(bundleCap: BundleCap, options?: Partial<DynamicVatOptions>) => Promise<CreateVatResults>} */
|
|
36
|
+
createVat: (bundleCap: BundleCap, options?: Partial<DynamicVatOptions>) => Promise<CreateVatResults>;
|
|
85
37
|
}>;
|
|
86
38
|
vatAdminState: {
|
|
87
39
|
getExitMessage: () => any;
|
|
@@ -97,6 +49,7 @@ export function makeFakeVatAdmin(testContextSetter?: (...args: any) => unknown,
|
|
|
97
49
|
* @param {EndoZipBase64Bundle | TestBundle} bundle
|
|
98
50
|
*/
|
|
99
51
|
registerBundle: (base: string, bundle: EndoZipBase64Bundle | TestBundle) => string;
|
|
52
|
+
prepareJig: () => Promise<any>;
|
|
100
53
|
/**
|
|
101
54
|
* @param {string} id
|
|
102
55
|
* @param {EndoZipBase64Bundle | TestBundle} bundle
|
|
@@ -113,6 +66,9 @@ export function makeFakeVatAdmin(testContextSetter?: (...args: any) => unknown,
|
|
|
113
66
|
};
|
|
114
67
|
};
|
|
115
68
|
};
|
|
69
|
+
import type { BundleCap } from '@agoric/swingset-vat';
|
|
70
|
+
import type { DynamicVatOptions } from '@agoric/swingset-vat';
|
|
71
|
+
import type { CreateVatResults } from '@agoric/swingset-vat';
|
|
116
72
|
import type { EndoZipBase64Bundle } from '@agoric/swingset-vat';
|
|
117
73
|
import type { TestBundle } from '@agoric/swingset-vat';
|
|
118
74
|
//# sourceMappingURL=fakeVatAdmin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fakeVatAdmin.d.ts","sourceRoot":"","sources":["fakeVatAdmin.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fakeVatAdmin.d.ts","sourceRoot":"","sources":["fakeVatAdmin.js"],"names":[],"mappings":"AAuBA,+BAA4C;;AAgM5C;;;;;IAtII,wGAAwG;eAA7F,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,KAAK,OAAO,CAAC,gBAAgB,CAAC;;;;;;IAApG,wGAAwG;eAA7F,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,KAAK,OAAO,CAAC,gBAAgB,CAAC;GAsI1D;AA9L9C;;;GAGG;AACH,qDAHW,CAAC,GAAG,IAAI,KAAA,KAAK,OAAO,eACpB,CAAC,CAAC,EAAE,OAAO,KAAK,OAAO;;;;;;QAsD9B,wGAAwG;mBAA7F,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,KAAK,OAAO,CAAC,gBAAgB,CAAC;;;;;;QAApG,wGAAwG;mBAA7F,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,KAAK,OAAO,CAAC,gBAAgB,CAAC;;;;;;QA+DpG;;;WAGG;4BAFQ,MAAM,UACN,mBAAmB,GAAG,UAAU;QAW3C;;;WAGG;+BAFQ,MAAM,UACN,mBAAmB,GAAG,UAAU;;QAa3C;;;WAGG;4BAFQ,MAAM,UACN,mBAAmB,GAAG,UAAU;;;;;;kCAzIkB,MAAM;;;;;EA2KtE;+BAlMsE,sBAAsB;uCACzD,sBAAsB;sCACvB,sBAAsB;yCAFc,sBAAsB;gCAAtB,sBAAsB"}
|
package/tools/fakeVatAdmin.js
CHANGED
|
@@ -6,21 +6,17 @@ import { makePromiseKit } from '@endo/promise-kit';
|
|
|
6
6
|
import { Far } from '@endo/marshal';
|
|
7
7
|
import { makeScalarMapStore } from '@agoric/store';
|
|
8
8
|
import { makeScalarBigMapStore } from '@agoric/vat-data';
|
|
9
|
-
import { unsafeSharedBundleCache } from '@agoric/swingset-vat/tools/bundleTool.js';
|
|
10
|
-
import { zoeSourceSpecRegistry } from '../source-spec-registry.js';
|
|
11
|
-
|
|
12
|
-
import { evalContractBundle } from '../src/contractFacet/evalContractCode.js';
|
|
13
9
|
import { handlePKitWarning } from '../src/handleWarning.js';
|
|
14
10
|
import { makeHandle } from '../src/makeHandle.js';
|
|
11
|
+
import { buildTestRootObject } from './testVatRoot.js';
|
|
15
12
|
|
|
16
13
|
/**
|
|
17
14
|
* @import {MapStore} from '@agoric/swingset-liveslots';
|
|
18
15
|
* @import {BundleCap, BundleID, EndoZipBase64Bundle, TestBundle} from '@agoric/swingset-vat';
|
|
16
|
+
* @import {DynamicVatOptions} from '@agoric/swingset-vat';
|
|
17
|
+
* @import {CreateVatResults} from '@agoric/swingset-vat';
|
|
19
18
|
*/
|
|
20
19
|
|
|
21
|
-
const bundleCache = await unsafeSharedBundleCache;
|
|
22
|
-
const { zcfBundle } = await bundleCache.loadRegistry(zoeSourceSpecRegistry);
|
|
23
|
-
|
|
24
20
|
// this simulates a bundlecap, which is normally a swingset "device node"
|
|
25
21
|
/** @type {() => BundleCap} */
|
|
26
22
|
const fakeBundleCap = () => makeHandle('FakeBundleCap');
|
|
@@ -54,6 +50,8 @@ function makeFakeVatAdmin(testContextSetter = undefined, makeRemote = x => x) {
|
|
|
54
50
|
}),
|
|
55
51
|
testJigSetter: testContextSetter,
|
|
56
52
|
};
|
|
53
|
+
/** @type {Array<ReturnType<typeof makePromiseKit>>} */
|
|
54
|
+
const reservedTestJigs = [];
|
|
57
55
|
|
|
58
56
|
// This is explicitly intended to be mutable so that
|
|
59
57
|
// test-only state can be provided from contracts
|
|
@@ -81,8 +79,11 @@ function makeFakeVatAdmin(testContextSetter = undefined, makeRemote = x => x) {
|
|
|
81
79
|
getBundleIDByName: name => {
|
|
82
80
|
return Promise.resolve().then(() => nameToBundleID.get(name));
|
|
83
81
|
},
|
|
82
|
+
/** @type {(bundleCap: BundleCap, options?: Partial<DynamicVatOptions>) => Promise<CreateVatResults>} */
|
|
84
83
|
createVat: (bundleCap, { vatParameters = {} } = {}) => {
|
|
85
84
|
bundleCap === zcfBundleCap || Fail`fakeVatAdmin only knows ZCF`;
|
|
85
|
+
const testJigKit = reservedTestJigs.shift() || makePromiseKit();
|
|
86
|
+
handlePKitWarning(testJigKit);
|
|
86
87
|
const exitKit = makePromiseKit();
|
|
87
88
|
handlePKitWarning(exitKit);
|
|
88
89
|
const exitVat = completion => {
|
|
@@ -93,6 +94,10 @@ function makeFakeVatAdmin(testContextSetter = undefined, makeRemote = x => x) {
|
|
|
93
94
|
};
|
|
94
95
|
const vpow = harden({
|
|
95
96
|
...fakeVatPowers,
|
|
97
|
+
testJigSetter: jig => {
|
|
98
|
+
testContextSetter?.(jig);
|
|
99
|
+
testJigKit.resolve(jig);
|
|
100
|
+
},
|
|
96
101
|
exitVat,
|
|
97
102
|
});
|
|
98
103
|
const vatBaggage = makeScalarBigMapStore('fake vat baggage', {
|
|
@@ -109,11 +114,7 @@ function makeFakeVatAdmin(testContextSetter = undefined, makeRemote = x => x) {
|
|
|
109
114
|
// }),
|
|
110
115
|
// );
|
|
111
116
|
const rootP = makeRemote(
|
|
112
|
-
|
|
113
|
-
vpow,
|
|
114
|
-
vatParameters,
|
|
115
|
-
vatBaggage,
|
|
116
|
-
),
|
|
117
|
+
buildTestRootObject(vpow, vatParameters, vatBaggage),
|
|
117
118
|
);
|
|
118
119
|
return E.when(rootP, root =>
|
|
119
120
|
harden({
|
|
@@ -163,6 +164,12 @@ function makeFakeVatAdmin(testContextSetter = undefined, makeRemote = x => x) {
|
|
|
163
164
|
vatAdminState.installBundle(bid, bundle);
|
|
164
165
|
return bid;
|
|
165
166
|
},
|
|
167
|
+
prepareJig: () => {
|
|
168
|
+
const jigKit = makePromiseKit();
|
|
169
|
+
handlePKitWarning(jigKit);
|
|
170
|
+
reservedTestJigs.push(jigKit);
|
|
171
|
+
return jigKit.promise;
|
|
172
|
+
},
|
|
166
173
|
/**
|
|
167
174
|
* @param {string} id
|
|
168
175
|
* @param {EndoZipBase64Bundle | TestBundle} bundle
|
package/tools/setup-zoe.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export function setUpZoeForTest<T extends unknown = any>({ setJig, feeIssuerConf
|
|
|
23
23
|
getExitWithFailure: () => any;
|
|
24
24
|
getBundleID: (base: string, bundle: EndoZipBase64Bundle | TestBundle) => string;
|
|
25
25
|
registerBundle: (base: string, bundle: EndoZipBase64Bundle | TestBundle) => string;
|
|
26
|
+
prepareJig: () => Promise<any>;
|
|
26
27
|
installBundle: (id: string, bundle: EndoZipBase64Bundle | TestBundle) => any;
|
|
27
28
|
installNamedBundle: (name: any, id: any, bundle: any) => any;
|
|
28
29
|
getCriticalVatKey: () => {};
|
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":"AAgBO,gDAFI,WAAW;;;;;;;EAOrB;AAKM,6CAFI,WAAW,2EAGqB;AAapC,gCAPgB,CAAC,mFAErB;IAAmC,MAAM,UAA3B,CAAC,KAAK,IAAI;IACU,eAAe;IACnB,WAAW;IACf,aAAa;CAAC;;;sCAoD9B,MAAM,aACN,MAAM,KACJ,OAAO,CAAC,YAAY,CAAC
|
|
1
|
+
{"version":3,"file":"setup-zoe.d.ts","sourceRoot":"","sources":["setup-zoe.js"],"names":[],"mappings":"AAgBO,gDAFI,WAAW;;;;;;;EAOrB;AAKM,6CAFI,WAAW,2EAGqB;AAapC,gCAPgB,CAAC,mFAErB;IAAmC,MAAM,UAA3B,CAAC,KAAK,IAAI;IACU,eAAe;IACnB,WAAW;IACf,aAAa;CAAC;;;sCAoD9B,MAAM,aACN,MAAM,KACJ,OAAO,CAAC,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;GAoBnC;iCAvG8D,sBAAsB;qCACrC,uBAAuB;kCAAvB,uBAAuB;yCADR,sBAAsB;gCAAtB,sBAAsB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export const buildTestRootObject: (powers: any, vatParameters: {
|
|
2
|
+
contractBundleCap: import("@agoric/swingset-vat").BundleCap;
|
|
3
|
+
zoeService: import("../src/types-index.js").ZoeService;
|
|
4
|
+
invitationIssuer: import("@agoric/ertp").Issuer<"set">;
|
|
5
|
+
privateArgs?: any;
|
|
6
|
+
}, baggage: import("@agoric/vat-data").Baggage) => Promise<import("@endo/pass-style").RemotableObject<`Alleged: ${string}`> & import("@endo/eventual-send").RemotableBrand<{}, {}>>;
|
|
7
|
+
//# sourceMappingURL=testVatRoot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testVatRoot.d.ts","sourceRoot":"","sources":["testVatRoot.js"],"names":[],"mappings":"AAKA;;;;eAEwf,CAAC;oLAFnb"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { makeBuildRootObject } from '../src/contractFacet/buildRootObject.js';
|
|
2
|
+
import { makeZCFZygote } from '../src/contractFacet/zcfZygote.js';
|
|
3
|
+
|
|
4
|
+
// Tests can use a source-level vat root directly instead of re-evaluating the
|
|
5
|
+
// bundled ZCF vat code through fakeVatAdmin on every createVat().
|
|
6
|
+
export const buildTestRootObject = makeBuildRootObject(makeZCFZygote);
|
|
7
|
+
harden(buildTestRootObject);
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export namespace zoeSourceSpecRegistry {
|
|
2
|
-
namespace zcf {
|
|
3
|
-
let bundleName: string;
|
|
4
|
-
let packagePath: string;
|
|
5
|
-
let sourceSpec: string;
|
|
6
|
-
}
|
|
7
|
-
namespace automaticRefund {
|
|
8
|
-
let bundleName_1: string;
|
|
9
|
-
export { bundleName_1 as bundleName };
|
|
10
|
-
let packagePath_1: string;
|
|
11
|
-
export { packagePath_1 as packagePath };
|
|
12
|
-
let sourceSpec_1: string;
|
|
13
|
-
export { sourceSpec_1 as sourceSpec };
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
export function getZoeSourceSpec(name: keyof typeof zoeSourceSpecRegistry): {
|
|
17
|
-
bundleName: string;
|
|
18
|
-
packagePath: string;
|
|
19
|
-
sourceSpec: string;
|
|
20
|
-
} | {
|
|
21
|
-
bundleName: string;
|
|
22
|
-
packagePath: string;
|
|
23
|
-
sourceSpec: string;
|
|
24
|
-
};
|
|
25
|
-
//# sourceMappingURL=source-spec-registry.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"source-spec-registry.d.ts","sourceRoot":"","sources":["source-spec-registry.js"],"names":[],"mappings":";;;;;;;;;;;;;;;AAsBO,uCADK,MAAM,OAAO,qBAAqB;;;;;;;;EACqB"}
|