From 14b9af42103b4e3746496f8e6a5972d15414ae0c Mon Sep 17 00:00:00 2001 From: "Mark S. Miller" Date: Fri, 28 Jun 2024 00:11:21 -0700 Subject: [PATCH] refactor(SwingSet): minor tidying extracted from #9539 (#9558) closes: #XXXX refs: https://github.com/Agoric/agoric-sdk/pull/9539/files#r1648285867 ## Description As @warner suggests at https://github.com/Agoric/agoric-sdk/pull/9539#discussion_r1648285867 , I'm moving that change to this separate PR so we can decide separately when to merge it. It should be a pure refactor, since nothing should have been counting on the absence of the `harden` ### Security Considerations `harden`ing early is better for integrity, and will catch some integrity-violating bugs (property mutations) earlier. Almost certainly no difference in this case though, but good precedent for reenforce best practices. In fact, within the SwingSet kernel, this cannot have any effect on production under current configurations, where `harden` is turned off for SwingSet anyway. But at least we still have the option of turning `harden` on when testing, in which case we still get the bug finding benefit. Finally, it is possible we will someday find we can afford to turn `harden` back on for SwingSet as a whole, in which case we get back this integrity protection for real. ***PLEASE establish the habit of `harden`ing literals before they escape whenever possible!*** ### Scaling Considerations none ### Documentation Considerations none ### Testing Considerations `harden` in SwingSet could be turned on during testing, in which case these `harden` calls with detect more bugs. ### Upgrade Considerations Why we pulled this out into a separate PR. See https://github.com/Agoric/agoric-sdk/pull/9539/files#r1648285867 --- packages/SwingSet/src/vats/vat-admin/vat-vat-admin.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/SwingSet/src/vats/vat-admin/vat-vat-admin.js b/packages/SwingSet/src/vats/vat-admin/vat-vat-admin.js index 4cc363dc572..2ee906d4526 100644 --- a/packages/SwingSet/src/vats/vat-admin/vat-vat-admin.js +++ b/packages/SwingSet/src/vats/vat-admin/vat-vat-admin.js @@ -318,9 +318,7 @@ export function buildRootObject(vatPowers, _vatParameters, baggage) { noteRunningVat(vatID); const adminNode = makeAdminNode(vatID); - return E.when(pendingP, root => { - return { adminNode, root }; - }); + return E.when(pendingP, root => harden({ adminNode, root })); } function getCriticalVatKey() {