Skip to content

Commit

Permalink
note the limitations/assumptions of insistSameCapData
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
warner authored and turadg committed Apr 12, 2023
1 parent 243103a commit 5d36843
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/swingset-liveslots/src/virtualObjectManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)`;
}
Expand Down

0 comments on commit 5d36843

Please sign in to comment.