Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(liveslots): relaxDurability should ignore promises #9539

Merged
merged 1 commit into from
Jul 10, 2024

Conversation

erights
Copy link
Member

@erights erights commented Jun 20, 2024

closes: #9599

Description

Just an experiment to see what breaks under CI if we make promises non-durable even if relaxDurabilityRules is true.

Security Considerations

Scaling Considerations

Documentation Considerations

Testing Considerations

Upgrade Considerations

Note that this PR changes liveslots (specifically src/virtualReferences.js), which triggers concerns about how pre-existing/deployed vats might (or might not) receive these changes. In this case, the liveslots change does not affect the behavior of real vats: it only behaves differently if relaxDurabilityRules = true, and we don't provide any way to enable that in a real kernel.

This will change the contents of the liveslots bundle, which will be used by new vats, or by vats which are upgraded for any reason (once this code is deployed to the chain). But this PR should not cause any concerns about test behavior diverging between trunk and mainnet.

@erights erights self-assigned this Jun 20, 2024
@erights erights requested a review from warner June 20, 2024 01:58
Copy link

cloudflare-workers-and-pages bot commented Jun 20, 2024

Deploying agoric-sdk with  Cloudflare Pages  Cloudflare Pages

Latest commit: 5c39d56
Status: ✅  Deploy successful!
Preview URL: https://0e762a69.agoric-sdk.pages.dev
Branch Preview URL: https://markm-reform-relaxdurability.agoric-sdk.pages.dev

View logs

@erights erights force-pushed the markm-reform-relaxDurabilityRules branch 4 times, most recently from 76c5375 to 1d0e95f Compare June 20, 2024 20:19
@erights erights assigned warner and unassigned erights Jun 20, 2024
@warner warner force-pushed the markm-reform-relaxDurabilityRules branch from 8a38fc2 to 5c7a7fb Compare June 27, 2024 01:11
mergify bot pushed a commit that referenced this pull request Jun 28, 2024
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
@turadg turadg force-pushed the markm-reform-relaxDurabilityRules branch from 5c7a7fb to 959aaf7 Compare July 9, 2024 22:54
@turadg
Copy link
Member

turadg commented Jul 9, 2024

I rebased this to resolve merge conflicts.

@warner @erights what's left to get it into trunk?

@warner warner marked this pull request as ready for review July 10, 2024 00:14
We have "fake vat" testing environments which configure their copy of
liveslots with a setting named `relaxDurabilityRules = true`. This
changes the rules for durable objects, which normally refuse to accept
non-durable state. When the rules are relaxed, they accept ephemeral
and merely-virtual objects as well.

Promises were never supposed to be accepted, even when the rules are
relaxed. But liveslots had a bug, and accepted Promises in the relaxed
mode. This PR changes liveslots to correctly reject them.

Lacking this enforcement, some other packages had mistakenly stored
Promises in durable objects, and gotten away with it. Now that
liveslots is fixed, their tests would fail. So this PR also fixes
those packages.

One case is the smart-wallet, whose tests which use contexts.js will
get a Zoe that uses fully-resolved `agoricNames` and `board`. But some
tests are deliberately not using that context, to exercise what
happens when E(zoe).startInstance() is given bad arguments.

This changes the tests to use bad *resolved* arguments, as to Promises
for bad arguments, because the latter now fails in a different
way. Giving Zoe a promise in `terms` causes "value for instanceRecord
is not durable", which is not what this test is trying to
exercise.

In addition, the expected error message was updated, because it now
mentions things like "NameHubKit" instead of "Promise" in the
unrelated (good) arguments.

The provisionPool test was fixed with an unsatisfying `await null`
stall. See #9598 for notes and plans for a better fix.
@warner warner force-pushed the markm-reform-relaxDurabilityRules branch from 959aaf7 to 5c39d56 Compare July 10, 2024 00:15
@warner warner self-requested a review July 10, 2024 00:17
Copy link
Member

@warner warner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think all the other tests are passing, and the liveslots changes are ok.

@warner warner added the automerge:rebase Automatically rebase updates, then merge label Jul 10, 2024
@turadg turadg changed the title WIP test(liveslots): promises are not durable even if relaxDurability… test(liveslots): relaxDurability should ignore promises Jul 10, 2024
@warner warner added the liveslots requires vat-upgrade to deploy changes label Jul 10, 2024
@mergify mergify bot merged commit 0006934 into master Jul 10, 2024
91 of 97 checks passed
@mergify mergify bot deleted the markm-reform-relaxDurabilityRules branch July 10, 2024 01:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge:rebase Automatically rebase updates, then merge liveslots requires vat-upgrade to deploy changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

liveslots relaxDurabilityMode admits Promises when it should reject them
3 participants