Skip to content

Commit

Permalink
fix: detect extra syscalls in replay
Browse files Browse the repository at this point in the history
  • Loading branch information
FUDCo committed May 11, 2021
1 parent d6c1de6 commit 6b6f837
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/SwingSet/src/kernel/vatManager/manager-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ function makeManagerKit(
});
// eslint-disable-next-line no-await-in-loop
await deliver(t.d);
transcriptManager.finishReplayDelivery();
kernelSlog.write({ type: 'finish-replay-delivery', vatID, deliveryNum });
deliveryNum += 1;
}
Expand Down
17 changes: 17 additions & 0 deletions packages/SwingSet/src/kernel/vatManager/transcript.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,22 @@ export function makeTranscriptManager(vatKeeper, vatID) {
return s.response;
}

function finishReplayDelivery() {
if (playbackSyscalls.length !== 0) {
console.log(`anachrophobia strikes vat ${vatID}`);
console.log(
`delivery completed with ${playbackSyscalls.length} expected syscalls remaining`,
);
for (const s of playbackSyscalls) {
console.log(`expected:`, djson.stringify(s.d));
}
if (!replayError) {
replayError = new Error(`historical inaccuracy in replay of ${vatID}`);
}
throw replayError;
}
}

function checkReplayError() {
if (replayError) {
throw replayError;
Expand All @@ -73,6 +89,7 @@ export function makeTranscriptManager(vatKeeper, vatID) {
startReplayDelivery,
finishReplay,
simulateSyscall,
finishReplayDelivery,
checkReplayError,
inReplay,
});
Expand Down

0 comments on commit 6b6f837

Please sign in to comment.