Skip to content

Commit

Permalink
chore(SwingSet): Use consistent prefixes for delivery/syscall numbers…
Browse files Browse the repository at this point in the history
… in anachrophobia messages

delivery d$N, syscall sc$N
#10469 (comment)
  • Loading branch information
gibson042 committed Dec 9, 2024
1 parent e34a2d2 commit cd33813
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions packages/SwingSet/src/kernel/vat-warehouse.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export function makeSyscallSimulator(
deliveryNum,
transcriptEntry,
) {
const context = `anachrophobia in ${vatID} delivery ${deliveryNum}`;
const context = `anachrophobia in ${vatID} delivery d${deliveryNum}`;
const syscallsExpected = [...transcriptEntry.sc]; // copy
const syscallsMade = [];
// syscallStatus's length will be max(syscallsExpected,
Expand All @@ -109,35 +109,35 @@ export function makeSyscallSimulator(

const explain = () => {
console.log(
`anachrophobia strikes ${vatID} syscalls for delivery ${deliveryNum}`,
`anachrophobia strikes ${vatID} delivery d${deliveryNum} syscalls`,
);
for (const [idx, status] of syscallStatus.entries()) {
const expected = syscallsExpected[idx];
const got = syscallsMade[idx];
switch (status) {
case 'ok': {
console.log(`sc[${idx}]: ok: ${djson.stringify(got)}`);
console.log(`sc${idx}: ok: ${djson.stringify(got)}`);
break;
}
case 'wrong': {
console.log(
`
sc[${idx}]: WRONG
sc${idx}: WRONG
expected: ${djson.stringify(expected.s)}
got : ${djson.stringify(got)}`.trimStart(),
);
break;
}
case 'extra': {
console.log(`sc[${idx}]: EXTRA: ${djson.stringify(got)}`);
console.log(`sc${idx}: EXTRA: ${djson.stringify(got)}`);
break;
}
case 'missing': {
console.log(`sc[${idx}]: MISSING: ${djson.stringify(expected.s)}`);
console.log(`sc${idx}: MISSING: ${djson.stringify(expected.s)}`);
break;
}
default:
Fail`bad ${status}`;
Fail`sc${idx}: bad status ${status}`;
}
}
};
Expand All @@ -149,13 +149,13 @@ sc[${idx}]: WRONG
const idx = syscallsMade.push(vso) - 1;
if (!expected) {
syscallStatus.push('extra');
const error = Error(`${context}: extra syscall at index ${idx}`);
const error = Error(`${context}: extra syscall at index sc${idx}`);
replayError ||= error;
throw error;
}
if (!syscallsAreIdentical(expected.s, vso)) {
syscallStatus.push('wrong');
const error = Error(`${context}: wrong syscall at index ${idx}`);
const error = Error(`${context}: wrong syscall at index sc${idx}`);
replayError ||= error;
throw error;
}
Expand All @@ -171,7 +171,7 @@ sc[${idx}]: WRONG
syscallStatus.push('missing');
}
const error = Error(
`${context}: missing ${missing} syscall(s) at index ${syscallsMade.length}`,
`${context}: missing ${missing} syscall(s) at index sc${syscallsMade.length}`,
);
replayError ||= error;
}
Expand Down

0 comments on commit cd33813

Please sign in to comment.