From 9a9ea0b794fe1ea6ac34e94563a313acc2a42772 Mon Sep 17 00:00:00 2001 From: Mathieu Hofman Date: Tue, 27 Dec 2022 00:13:55 +0000 Subject: [PATCH] feat(swingset-tools): [replay] Option to load snapshots through config --- .../SwingSet/misc-tools/replay-transcript.js | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/packages/SwingSet/misc-tools/replay-transcript.js b/packages/SwingSet/misc-tools/replay-transcript.js index ae0d6709c48..2893270f80c 100644 --- a/packages/SwingSet/misc-tools/replay-transcript.js +++ b/packages/SwingSet/misc-tools/replay-transcript.js @@ -141,6 +141,9 @@ const argv = yargsParser(process.argv.slice(2), { recordXsnapTrace: false, useXsnapDebug: false, }, + config: { + config: true, + }, configuration: { 'duplicate-arguments-array': false, 'flatten-duplicate-arrays': false, @@ -978,6 +981,23 @@ async function replay(transcriptFile) { ); } } + + const loadSnapshots = [].concat( + argv.loadSnapshots?.[transcriptNum] || [], + ); + for (const snapshotID of loadSnapshots) { + // eslint-disable-next-line no-await-in-loop + await loadSnapshot( + { + snapshotID, + vatID, + }, + argv.keepWorkerExplicitLoad || + (argv.keepWorkerHashDifference && + (loadSnapshots.length > 1 || + !uniqueSnapshotIDs.includes(snapshotID))), + ); + } } } } finally {