Skip to content

Commit

Permalink
fix: anachrophobia should crash hard
Browse files Browse the repository at this point in the history
Closes #68

Now the SwingSet kernel will not proceed if there is anachrophobia.
The cases that cause this still need to be diagnosed, but at least
we won't have easily-overlooked failures.
  • Loading branch information
michaelfig committed Mar 6, 2020
1 parent 4adc6be commit 42deaaf
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion packages/SwingSet/src/kernel/vatManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,13 +212,15 @@ export default function makeVatManager(
return harden({ ...ret, slots: retSlots });
}

let replayAbandonShip;
function replay(name, ...args) {
const s = playbackSyscalls.shift();
if (djson.stringify(s.d) !== djson.stringify([name, ...args])) {
console.log(`anachrophobia strikes vat ${vatID}`);
console.log(`expected:`, djson.stringify(s.d));
console.log(`got :`, djson.stringify([name, ...args]));
throw new Error(`historical inaccuracy in replay-${name}`);
replayAbandonShip = new Error(`historical inaccuracy in replay-${name}`);
throw replayAbandonShip;
}
return s.response;
}
Expand Down Expand Up @@ -375,6 +377,10 @@ export default function makeVatManager(

inReplay = true;
for (const t of vatKeeper.getTranscript()) {
if (replayAbandonShip) {
// We really failed to start.
throw replayAbandonShip;
}
playbackSyscalls = Array.from(t.syscalls);
// eslint-disable-next-line no-await-in-loop
await doProcess(
Expand All @@ -384,6 +390,11 @@ export default function makeVatManager(
)}]`,
);
}

if (replayAbandonShip) {
// We really failed to start.
throw replayAbandonShip;
}
inReplay = false;
}

Expand Down

0 comments on commit 42deaaf

Please sign in to comment.