@agoric/swingset-vat 0.32.3-dev-648d42f.0 → 0.32.3-dev-dfc712f.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-648d42f.0+648d42f",
3
+ "version": "0.32.3-dev-dfc712f.0+dfc712f",
4
4
  "description": "Vat/Container Launcher",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -26,16 +26,16 @@
26
26
  "@types/tmp": "^0.2.0"
27
27
  },
28
28
  "dependencies": {
29
- "@agoric/assert": "0.6.1-dev-648d42f.0+648d42f",
30
- "@agoric/internal": "0.3.3-dev-648d42f.0+648d42f",
31
- "@agoric/store": "0.9.3-dev-648d42f.0+648d42f",
32
- "@agoric/swing-store": "0.9.2-dev-648d42f.0+648d42f",
33
- "@agoric/swingset-liveslots": "0.10.3-dev-648d42f.0+648d42f",
34
- "@agoric/swingset-xsnap-supervisor": "0.10.3-dev-648d42f.0+648d42f",
35
- "@agoric/time": "0.3.3-dev-648d42f.0+648d42f",
36
- "@agoric/vat-data": "0.5.3-dev-648d42f.0+648d42f",
37
- "@agoric/xsnap": "0.14.3-dev-648d42f.0+648d42f",
38
- "@agoric/xsnap-lockdown": "0.14.1-dev-648d42f.0+648d42f",
29
+ "@agoric/assert": "0.6.1-dev-dfc712f.0+dfc712f",
30
+ "@agoric/internal": "0.3.3-dev-dfc712f.0+dfc712f",
31
+ "@agoric/store": "0.9.3-dev-dfc712f.0+dfc712f",
32
+ "@agoric/swing-store": "0.9.2-dev-dfc712f.0+dfc712f",
33
+ "@agoric/swingset-liveslots": "0.10.3-dev-dfc712f.0+dfc712f",
34
+ "@agoric/swingset-xsnap-supervisor": "0.10.3-dev-dfc712f.0+dfc712f",
35
+ "@agoric/time": "0.3.3-dev-dfc712f.0+dfc712f",
36
+ "@agoric/vat-data": "0.5.3-dev-dfc712f.0+dfc712f",
37
+ "@agoric/xsnap": "0.14.3-dev-dfc712f.0+dfc712f",
38
+ "@agoric/xsnap-lockdown": "0.14.1-dev-dfc712f.0+dfc712f",
39
39
  "@endo/base64": "^0.2.31",
40
40
  "@endo/bundle-source": "^2.5.1",
41
41
  "@endo/captp": "^3.1.1",
@@ -92,5 +92,5 @@
92
92
  "publishConfig": {
93
93
  "access": "public"
94
94
  },
95
- "gitHead": "648d42f4aedfcb521f5eaeea8dd10dd09e97b833"
95
+ "gitHead": "dfc712fe1fe243625d24b472acb72cad32c24b17"
96
96
  }
@@ -128,7 +128,7 @@ export function loadBasedir(basedir, options = {}) {
128
128
  const vats = {};
129
129
  const subs = fs.readdirSync(basedir, { withFileTypes: true });
130
130
  subs.sort(byName);
131
- subs.forEach(dirent => {
131
+ for (const dirent of subs) {
132
132
  if (
133
133
  dirent.name.startsWith('vat-') &&
134
134
  dirent.name.endsWith('.js') &&
@@ -138,7 +138,7 @@ export function loadBasedir(basedir, options = {}) {
138
138
  const vatSourcePath = path.resolve(basedir, dirent.name);
139
139
  vats[name] = { sourceSpec: vatSourcePath, parameters: {} };
140
140
  }
141
- });
141
+ }
142
142
  /** @type {string | void} */
143
143
  let bootstrapPath = path.resolve(basedir, 'bootstrap.js');
144
144
  try {
@@ -16,10 +16,10 @@ export function buildRootDeviceNode(tools) {
16
16
  );
17
17
  }
18
18
  assert.typeof(peer, 'string');
19
- messages.forEach(m => {
19
+ for (const m of messages) {
20
20
  Nat(m[0]);
21
21
  assert.typeof(m[1], 'string');
22
- });
22
+ }
23
23
  Nat(ack);
24
24
  if (messages.length) {
25
25
  deliverInboundMessages(peer, harden(messages));
@@ -74,9 +74,9 @@ import { Fail } from '@agoric/assert';
74
74
 
75
75
  export function importMailbox(data, inout = {}) {
76
76
  const outbox = new Map();
77
- data.outbox.forEach(m => {
77
+ for (const m of data.outbox) {
78
78
  outbox.set(Nat(m[0]), m[1]);
79
- });
79
+ }
80
80
  inout.ack = Nat(data.ack);
81
81
  inout.outbox = outbox;
82
82
  return inout;
@@ -84,9 +84,9 @@ export function importMailbox(data, inout = {}) {
84
84
 
85
85
  export function exportMailbox(inout) {
86
86
  const messages = [];
87
- inout.outbox.forEach((body, msgnum) => {
87
+ for (const [msgnum, body] of inout.outbox) {
88
88
  messages.push([Number(msgnum), body]);
89
- });
89
+ }
90
90
  messages.sort((a, b) => a[0] - b[0]);
91
91
  return {
92
92
  ack: Number(inout.ack),
@@ -121,13 +121,13 @@ export function buildMailboxStateMap(state = harden(new Map())) {
121
121
 
122
122
  function exportToData() {
123
123
  const data = {};
124
- state.forEach((inout, peer) => {
124
+ for (const [peer, inout] of state.entries()) {
125
125
  const exported = exportMailbox(inout);
126
126
  data[peer] = {
127
127
  inboundAck: exported.ack,
128
128
  outbox: exported.outbox,
129
129
  };
130
- });
130
+ }
131
131
  return harden(data);
132
132
  }
133
133
 
@@ -132,12 +132,12 @@ export function buildRootDeviceNode(tools) {
132
132
  }
133
133
 
134
134
  endowments.registerResetter(() => {
135
- connectedMods.forEach((mod, index) => {
135
+ for (const [index, mod] of connectedMods.entries()) {
136
136
  if (mod) {
137
137
  // console.info('Startup resetting', index, mod, nextEpochs[index]);
138
138
  SO(registeredReceiver).reset(index, nextEpochs[index]);
139
139
  }
140
- });
140
+ }
141
141
  });
142
142
 
143
143
  return Far('root', {
@@ -182,7 +182,7 @@ function curryPollFn(SO, repeaters, deadlines, getLastPolledFn, saveStateFn) {
182
182
  function poll(now) {
183
183
  const timeAndEvents = deadlines.removeEventsThrough(now);
184
184
  let wokeAnything = false;
185
- timeAndEvents.forEach(events => {
185
+ for (const events of timeAndEvents) {
186
186
  const { time, handlers } = events;
187
187
  assert.typeof(time, 'bigint');
188
188
  for (const { index, handler } of handlers) {
@@ -197,7 +197,7 @@ function curryPollFn(SO, repeaters, deadlines, getLastPolledFn, saveStateFn) {
197
197
  }
198
198
  wokeAnything = true;
199
199
  }
200
- });
200
+ }
201
201
  if (wokeAnything) {
202
202
  saveStateFn();
203
203
  }
@@ -98,7 +98,9 @@ export function makeKernelQueueHandler(tools) {
98
98
  // queue a message on the end of the queue, with 'absolute' krefs.
99
99
  // Use 'step' or 'run' to execute it
100
100
  const methargs = kser([method, args]);
101
- methargs.slots.forEach(s => parseKernelSlot(s));
101
+ for (const s of methargs.slots) {
102
+ parseKernelSlot(s);
103
+ }
102
104
  let resultKPID;
103
105
  if (policy !== 'none') {
104
106
  resultKPID = kernelKeeper.addKernelPromise(policy);
@@ -671,7 +671,9 @@ export default function makeKernelKeeper(kernelStorage, kernelSlog) {
671
671
  body: kvStore.get(`${kernelSlot}.data.body`),
672
672
  slots: commaSplit(kvStore.get(`${kernelSlot}.data.slots`)),
673
673
  };
674
- p.data.slots.forEach(parseKernelSlot);
674
+ for (const s of p.data.slots) {
675
+ parseKernelSlot(s);
676
+ }
675
677
  break;
676
678
  }
677
679
  default: {
@@ -1434,13 +1436,17 @@ export default function makeKernelKeeper(kernelStorage, kernelSlog) {
1434
1436
  state: { transcript: Array.from(vk.getTranscript()) },
1435
1437
  };
1436
1438
  vatTables.push(vatTable);
1437
- vk.dumpState().forEach(e => kernelTable.push(e));
1439
+ for (const e of vk.dumpState()) {
1440
+ kernelTable.push(e);
1441
+ }
1438
1442
  }
1439
1443
  }
1440
1444
 
1441
1445
  for (const deviceID of getAllDeviceIDs()) {
1442
1446
  const dk = allocateDeviceKeeperIfNeeded(deviceID);
1443
- dk.dumpState().forEach(e => kernelTable.push(e));
1447
+ for (const e of dk.dumpState()) {
1448
+ kernelTable.push(e);
1449
+ }
1444
1450
  }
1445
1451
 
1446
1452
  function compareNumbers(a, b) {
@@ -108,7 +108,7 @@ export function makeSyscallSimulator(
108
108
 
109
109
  const explain = () => {
110
110
  console.log(`anachrophobia strikes ${vatID} on delivery ${deliveryNum}`);
111
- syscallStatus.forEach((status, idx) => {
111
+ for (const [idx, status] of syscallStatus.entries()) {
112
112
  const expected = syscallsExpected[idx];
113
113
  const got = syscallsMade[idx];
114
114
  switch (status) {
@@ -133,7 +133,7 @@ export function makeSyscallSimulator(
133
133
  default:
134
134
  Fail`bad ${status}`;
135
135
  }
136
- });
136
+ }
137
137
  };
138
138
 
139
139
  const syscallHandler = vso => {
@@ -127,7 +127,9 @@ function makeTranslateKernelDeliveryToVatDelivery(vatID, kernelKeeper) {
127
127
  const vrefs = krefs.map(kref =>
128
128
  mapKernelSlotToVatSlot(kref, gcDeliveryMapOpts),
129
129
  );
130
- krefs.forEach(kref => vatKeeper.clearReachableFlag(kref, 'dropE'));
130
+ for (const kref of krefs) {
131
+ vatKeeper.clearReachableFlag(kref, 'dropE');
132
+ }
131
133
  /** @type { VatDeliveryDropExports } */
132
134
  const vatDelivery = harden(['dropExports', vrefs]);
133
135
  return vatDelivery;
@@ -120,11 +120,10 @@ export function buildCommsDispatch(syscall, _state, _helpers, _vatPowers) {
120
120
  // crank). The resulting abrupt comms vat termination should serve as a
121
121
  // diagnostic signal that we have a bug that must be corrected.
122
122
 
123
- methargs.slots.forEach(
124
- s =>
125
- !state.hasMetaObject(s) ||
126
- Fail`comms meta-object ${s} not allowed in message args`,
127
- );
123
+ for (const s of methargs.slots) {
124
+ !state.hasMetaObject(s) ||
125
+ Fail`comms meta-object ${s} not allowed in message args`;
126
+ }
128
127
  return sendFromKernel(target, methargs, result);
129
128
  }
130
129
 
@@ -351,7 +351,9 @@ export const buildRootObject = (vatPowers, _vatParameters, baggage) => {
351
351
  const processAndReschedule = () => {
352
352
  // first, service everything that is ready
353
353
  const now = getNow();
354
- removeEventsUpTo(schedule, now).forEach(event => event.fired(now));
354
+ for (const event of removeEventsUpTo(schedule, now)) {
355
+ event.fired(now);
356
+ }
355
357
  // then, reschedule for whatever is up next
356
358
  reschedule();
357
359
  };
@@ -642,7 +644,9 @@ export const buildRootObject = (vatPowers, _vatParameters, baggage) => {
642
644
  if (cancels.has(cancelToken)) {
643
645
  const cancelled = cancels.get(cancelToken);
644
646
  cancels.delete(cancelToken);
645
- cancelled.forEach(thing => thing.cancel());
647
+ for (const thing of cancelled) {
648
+ thing.cancel();
649
+ }
646
650
  }
647
651
  };
648
652
 
@@ -118,18 +118,29 @@ export function checkBaggage(db, vatID, verbose = false) {
118
118
 
119
119
  // Kinds which have been used but whose kindID handles have not been seen
120
120
  const usedButNotKnownKinds = new Set();
121
- usedKinds.forEach(v => usedButNotKnownKinds.add(v));
122
- knownKinds.forEach(v => usedButNotKnownKinds.delete(v));
121
+ for (const v of usedKinds) {
122
+ usedButNotKnownKinds.add(v);
123
+ }
124
+ for (const v of knownKinds) {
125
+ usedButNotKnownKinds.delete(v);
126
+ }
123
127
 
124
128
  // Kinds which exist but whose kind handles have not been seen
125
129
  const extantButNotSeen = new Map();
126
- extantKinds.forEach((k, v) => extantButNotSeen.set(v, k));
127
- knownKinds.forEach(k => extantButNotSeen.delete(k));
128
-
130
+ for (const [k, v] of extantKinds) {
131
+ extantButNotSeen.set(v, k);
132
+ }
133
+ for (const k of knownKinds) {
134
+ extantButNotSeen.delete(k);
135
+ }
129
136
  // Kinds which exist but are not used
130
137
  const extantButNotUsed = new Map();
131
- extantKinds.forEach((k, v) => extantButNotUsed.set(v, k));
132
- usedKinds.forEach(k => extantButNotUsed.delete(k));
138
+ for (const [k, v] of extantKinds) {
139
+ extantButNotUsed.set(v, k);
140
+ }
141
+ for (const k of usedKinds) {
142
+ extantButNotUsed.delete(k);
143
+ }
133
144
 
134
145
  if (verbose || usedButNotKnownKinds.size > 0) {
135
146
  console.log('predefinedKinds', predefinedKinds);