Skip to content

Commit

Permalink
refactor(SwingSet): minor tidying extracted from #9539 (#9558)
Browse files Browse the repository at this point in the history
closes: #XXXX
refs: https://github.com/Agoric/agoric-sdk/pull/9539/files#r1648285867

## Description

As @warner suggests at #9539 (comment) , 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
  • Loading branch information
erights authored Jun 28, 2024
1 parent 4adf64f commit 14b9af4
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions packages/SwingSet/src/vats/vat-admin/vat-vat-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 14b9af4

Please sign in to comment.