From 5d36843f14cb779067ee250228f9e5df66148a67 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Wed, 12 Apr 2023 09:59:19 -0700 Subject: [PATCH] note the limitations/assumptions of insistSameCapData This implementation assumes that both old and new stateShapes were marshalled with the same version (e.g. smallcaps vs pre-smallcaps). If we introduce a third format in the future, we should change insistSameCapData to re-serialize the old data into the current format before attempting to compare the capdata bodies. --- packages/swingset-liveslots/src/virtualObjectManager.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/swingset-liveslots/src/virtualObjectManager.js b/packages/swingset-liveslots/src/virtualObjectManager.js index 4cb198aea51b..170db46e019a 100644 --- a/packages/swingset-liveslots/src/virtualObjectManager.js +++ b/packages/swingset-liveslots/src/virtualObjectManager.js @@ -264,6 +264,9 @@ function insistDurableCapdata(vrm, what, capdata, valueFor) { } function insistSameCapData(oldCD, newCD) { + // NOTE: this assumes both were marshalled with the same format + // (e.g. smallcaps vs pre-smallcaps). To somewhat tolerate new + // formats, we'd need to `serialize(unserialize(oldCD))`. if (oldCD.body !== newCD.body) { Fail`durable Kind stateShape mismatch (body)`; }