@agoric/swingset-vat 0.32.3-dev-ad7ac3c.0 → 0.32.3-dev-d122756.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/swingset-vat",
|
|
3
|
-
"version": "0.32.3-dev-
|
|
3
|
+
"version": "0.32.3-dev-d122756.0+d122756",
|
|
4
4
|
"description": "Vat/Container Launcher",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -27,16 +27,16 @@
|
|
|
27
27
|
"@types/yargs-parser": "^21.0.0"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@agoric/internal": "0.3.3-dev-
|
|
31
|
-
"@agoric/kmarshal": "0.1.1-dev-
|
|
32
|
-
"@agoric/store": "0.9.3-dev-
|
|
33
|
-
"@agoric/swing-store": "0.9.2-dev-
|
|
34
|
-
"@agoric/swingset-liveslots": "0.10.3-dev-
|
|
35
|
-
"@agoric/swingset-xsnap-supervisor": "0.10.3-dev-
|
|
36
|
-
"@agoric/time": "0.3.3-dev-
|
|
37
|
-
"@agoric/vat-data": "0.5.3-dev-
|
|
38
|
-
"@agoric/xsnap": "0.14.3-dev-
|
|
39
|
-
"@agoric/xsnap-lockdown": "0.14.1-dev-
|
|
30
|
+
"@agoric/internal": "0.3.3-dev-d122756.0+d122756",
|
|
31
|
+
"@agoric/kmarshal": "0.1.1-dev-d122756.0+d122756",
|
|
32
|
+
"@agoric/store": "0.9.3-dev-d122756.0+d122756",
|
|
33
|
+
"@agoric/swing-store": "0.9.2-dev-d122756.0+d122756",
|
|
34
|
+
"@agoric/swingset-liveslots": "0.10.3-dev-d122756.0+d122756",
|
|
35
|
+
"@agoric/swingset-xsnap-supervisor": "0.10.3-dev-d122756.0+d122756",
|
|
36
|
+
"@agoric/time": "0.3.3-dev-d122756.0+d122756",
|
|
37
|
+
"@agoric/vat-data": "0.5.3-dev-d122756.0+d122756",
|
|
38
|
+
"@agoric/xsnap": "0.14.3-dev-d122756.0+d122756",
|
|
39
|
+
"@agoric/xsnap-lockdown": "0.14.1-dev-d122756.0+d122756",
|
|
40
40
|
"@endo/base64": "^1.0.8",
|
|
41
41
|
"@endo/bundle-source": "^3.4.2",
|
|
42
42
|
"@endo/captp": "^4.4.2",
|
|
@@ -103,5 +103,5 @@
|
|
|
103
103
|
"typeCoverage": {
|
|
104
104
|
"atLeast": 75.82
|
|
105
105
|
},
|
|
106
|
-
"gitHead": "
|
|
106
|
+
"gitHead": "d122756b667949664b0259f0a58f61d1d1f14d03"
|
|
107
107
|
}
|
package/src/kernel/kernel.js
CHANGED
|
@@ -710,6 +710,7 @@ export default function buildKernel(
|
|
|
710
710
|
total:
|
|
711
711
|
work.exports +
|
|
712
712
|
work.imports +
|
|
713
|
+
work.promises +
|
|
713
714
|
work.kv +
|
|
714
715
|
work.snapshots +
|
|
715
716
|
work.transcripts,
|
|
@@ -751,6 +752,8 @@ export default function buildKernel(
|
|
|
751
752
|
kdebug(`vat ${vatID} terminated before startVat delivered`);
|
|
752
753
|
return NO_DELIVERY_CRANK_RESULTS;
|
|
753
754
|
}
|
|
755
|
+
const vatKeeper = kernelKeeper.provideVatKeeper(vatID);
|
|
756
|
+
vatKeeper.setVatParameters(vatParameters);
|
|
754
757
|
const { meterID } = vatInfo;
|
|
755
758
|
/** @type { KernelDeliveryStartVat } */
|
|
756
759
|
const kd = harden(['startVat', vatParameters]);
|
|
@@ -1051,6 +1054,7 @@ export default function buildKernel(
|
|
|
1051
1054
|
});
|
|
1052
1055
|
const vatOptions = harden({ ...origOptions, workerOptions });
|
|
1053
1056
|
vatKeeper.setSourceAndOptions(source, vatOptions);
|
|
1057
|
+
vatKeeper.setVatParameters(vatParameters);
|
|
1054
1058
|
// TODO: decref the bundleID once setSourceAndOptions increfs it
|
|
1055
1059
|
|
|
1056
1060
|
// pause, take a deep breath, appreciate this moment of silence
|
|
@@ -1851,6 +1855,7 @@ export default function buildKernel(
|
|
|
1851
1855
|
{
|
|
1852
1856
|
exports: M.number(),
|
|
1853
1857
|
imports: M.number(),
|
|
1858
|
+
promises: M.number(),
|
|
1854
1859
|
kv: M.number(),
|
|
1855
1860
|
snapshots: M.number(),
|
|
1856
1861
|
transcripts: M.number(),
|
|
@@ -119,6 +119,8 @@ export const CURRENT_SCHEMA_VERSION = 3;
|
|
|
119
119
|
// old (v0): v$NN.reapCountdown = $NN or 'never'
|
|
120
120
|
// v$NN.reapDirt = JSON({ deliveries, gcKrefs, computrons }) // missing keys treated as zero
|
|
121
121
|
// (leave room for v$NN.snapshotDirt and options.snapshotDirtThreshold for #6786)
|
|
122
|
+
// v$NN.vatParameters = JSON(capdata) // missing for vats created/upgraded before #8947
|
|
123
|
+
//
|
|
122
124
|
// exclude from consensus
|
|
123
125
|
// local.*
|
|
124
126
|
|
|
@@ -1021,6 +1023,7 @@ export default function makeKernelKeeper(
|
|
|
1021
1023
|
const work = {
|
|
1022
1024
|
exports: 0,
|
|
1023
1025
|
imports: 0,
|
|
1026
|
+
promises: 0,
|
|
1024
1027
|
kv: 0,
|
|
1025
1028
|
snapshots: 0,
|
|
1026
1029
|
transcripts: 0,
|
|
@@ -1045,6 +1048,7 @@ export default function makeKernelKeeper(
|
|
|
1045
1048
|
const clistPrefix = `${vatID}.c.`;
|
|
1046
1049
|
const exportPrefix = `${clistPrefix}o+`;
|
|
1047
1050
|
const importPrefix = `${clistPrefix}o-`;
|
|
1051
|
+
const promisePrefix = `${clistPrefix}p`;
|
|
1048
1052
|
|
|
1049
1053
|
// Note: ASCII order is "+,-./", and we rely upon this to split the
|
|
1050
1054
|
// keyspace into the various o+NN/o-NN/etc spaces. If we were using a
|
|
@@ -1097,8 +1101,22 @@ export default function makeKernelKeeper(
|
|
|
1097
1101
|
}
|
|
1098
1102
|
}
|
|
1099
1103
|
|
|
1100
|
-
//
|
|
1101
|
-
// so they already
|
|
1104
|
+
// The caller used enumeratePromisesByDecider() before calling us,
|
|
1105
|
+
// so they have already rejected the orphan promises, but those
|
|
1106
|
+
// kpids are still present in the dead vat's c-list. Clean those
|
|
1107
|
+
// up now.
|
|
1108
|
+
remaining = budget.promises ?? budget.default;
|
|
1109
|
+
for (const k of enumeratePrefixedKeys(kvStore, promisePrefix)) {
|
|
1110
|
+
const kref = kvStore.get(k) || Fail`getNextKey ensures get`;
|
|
1111
|
+
const vref = stripPrefix(clistPrefix, k);
|
|
1112
|
+
vatKeeper.deleteCListEntry(kref, vref);
|
|
1113
|
+
// that will also delete both db keys
|
|
1114
|
+
work.promises += 1;
|
|
1115
|
+
remaining -= 1;
|
|
1116
|
+
if (remaining <= 0) {
|
|
1117
|
+
return { done: false, work };
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1102
1120
|
|
|
1103
1121
|
// now loop back through everything and delete it all
|
|
1104
1122
|
remaining = budget.kv ?? budget.default;
|
|
@@ -7,6 +7,7 @@ import { isObject } from '@endo/marshal';
|
|
|
7
7
|
import { parseKernelSlot } from '../parseKernelSlots.js';
|
|
8
8
|
import { makeVatSlot, parseVatSlot } from '../../lib/parseVatSlots.js';
|
|
9
9
|
import { insistVatID } from '../../lib/id.js';
|
|
10
|
+
import { insistCapData } from '../../lib/capdata.js';
|
|
10
11
|
import { kdebug } from '../../lib/kdebug.js';
|
|
11
12
|
import {
|
|
12
13
|
parseReachableAndVatSlot,
|
|
@@ -173,6 +174,35 @@ export function makeVatKeeper(
|
|
|
173
174
|
return harden(options);
|
|
174
175
|
}
|
|
175
176
|
|
|
177
|
+
/**
|
|
178
|
+
* @param {SwingSetCapData} newVPCD
|
|
179
|
+
*/
|
|
180
|
+
function setVatParameters(newVPCD) {
|
|
181
|
+
insistCapData(newVPCD);
|
|
182
|
+
const key = `${vatID}.vatParameters`;
|
|
183
|
+
// increment-before-decrement to minimize spurious rc=0 checks
|
|
184
|
+
for (const kref of newVPCD.slots) {
|
|
185
|
+
incrementRefCount(kref, `${vatID}.vatParameters`);
|
|
186
|
+
}
|
|
187
|
+
const old = kvStore.get(key) || '{"slots":[]}';
|
|
188
|
+
for (const kref of JSON.parse(old).slots) {
|
|
189
|
+
decrementRefCount(kref, `${vatID}.vatParameters`);
|
|
190
|
+
}
|
|
191
|
+
kvStore.set(key, JSON.stringify(newVPCD));
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* @returns {SwingSetCapData | undefined} vpcd
|
|
196
|
+
*/
|
|
197
|
+
function getVatParameters() {
|
|
198
|
+
const key = `${vatID}.vatParameters`;
|
|
199
|
+
const old = kvStore.get(key);
|
|
200
|
+
if (old) {
|
|
201
|
+
return JSON.parse(old);
|
|
202
|
+
}
|
|
203
|
+
return undefined;
|
|
204
|
+
}
|
|
205
|
+
|
|
176
206
|
// This is named "addDirt" because it should increment all dirt
|
|
177
207
|
// counters (both for reap/BOYD and for heap snapshotting). We don't
|
|
178
208
|
// have `heapSnapshotDirt` yet, but when we do, it should get
|
|
@@ -768,6 +798,8 @@ export function makeVatKeeper(
|
|
|
768
798
|
setSourceAndOptions,
|
|
769
799
|
getSourceAndOptions,
|
|
770
800
|
getOptions,
|
|
801
|
+
setVatParameters,
|
|
802
|
+
getVatParameters,
|
|
771
803
|
addDirt,
|
|
772
804
|
getReapDirt,
|
|
773
805
|
clearReapDirt,
|