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

refactor ZoeSeat to drop cyclic structure that blocked GC #8682

Merged
merged 4 commits into from
Mar 1, 2024

Conversation

Chris-Hibbert
Copy link
Contributor

closes: #8672

Description

Refactor ZoeSeat to be composed of two separate Exos, so that dropping one can allow the cyclic structure described in #8672 to be GC'd.

Security Considerations

N/A

Scaling Considerations

Vast improvement in reducing retained garbage.

Documentation Considerations

Invisible to users.

Testing Considerations

Needs further testing in the upgrade environment to demonstrate

  • classic ZoeSeats continue to function (and continue to retain cycles)
  • New ZoeSeats break the cycles when exited.

All existing tests in packages/zoe pass, with two tests requiring minor changes to error messages.

Upgrade Considerations

See above.

@Chris-Hibbert Chris-Hibbert added Zoe package: Zoe performance Performance related issues resource-exhaustion Threats to availability from resource exhaustion attacks labels Dec 20, 2023
@Chris-Hibbert Chris-Hibbert self-assigned this Dec 20, 2023
@Chris-Hibbert Chris-Hibbert force-pushed the 8672-acyclicZoeSeatKit branch 2 times, most recently from 59596b6 to 0fe0d3c Compare December 20, 2023 19:54
Copy link
Member

@erights erights left a comment

Choose a reason for hiding this comment

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

Do the existing tests cover the following case, or does this PR need an explicit test for it?

  • Upgrading a zoe that already has some old style seats.

Even if that case is covered, would be to verify that the old seats differ from the new seats in the way you expect.

@Chris-Hibbert
Copy link
Contributor Author

Do the existing tests cover the following case, or does this PR need an explicit test for it?

  • Upgrading a zoe that already has some old style seats.

It's mentioned under Testing Considerations, above, as missing.

Even if that case is covered, would be to verify that the old seats differ from the new seats in the way you expect.

I presume that manual inspection in a debugging environment would suffice, as I don't know how to add this to a regression test.

@erights
Copy link
Member

erights commented Dec 21, 2023 via email

Comment on lines 20 to 53
const OriginalZoeSeatIKit = harden({
zoeSeatAdmin: M.interface('ZoeSeatAdmin', {
replaceAllocation: M.call(AmountKeywordRecordShape).returns(),
exit: M.call(M.any()).returns(),
fail: M.call(M.any()).returns(),
resolveExitAndResult: M.call({
offerResultPromise: M.promise(),
exitObj: ExitObjectShape,
}).returns(),
getExitSubscriber: M.call().returns(SubscriberShape),
// The return promise is empty, but doExit relies on settlement as a signal
// that the payouts have settled. The exit publisher is notified after that.
finalPayouts: M.call(M.eref(PaymentPKeywordRecordShape)).returns(
M.promise(),
),
}),
userSeat: M.interface('UserSeat', {
getProposal: M.call().returns(M.promise()),
getPayouts: M.call().returns(M.promise()),
getPayout: M.call(KeywordShape).returns(M.promise()),
getOfferResult: M.call().returns(M.promise()),
hasExited: M.call().returns(M.promise()),
tryExit: M.call().returns(M.promise()),
numWantsSatisfied: M.call().returns(M.promise()),
getFinalAllocation: M.call().returns(M.promise()),
getExitSubscriber: M.call().returns(M.any()),
}),
});
Copy link
Member

Choose a reason for hiding this comment

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

These seem identical with those in zoeSeat.js . Please de duplicate. If neither file should import the other, consider moving to a shared typeGuards.js . The commonality suggests that the interface is supposed to be the same.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Member

@erights erights left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@erights
Copy link
Member

erights commented Jan 13, 2024

Noting that #8517 provides a similar form of indirection in a more reusable manner, but bundled with ownability, which is not yet relevant. Still might be a good source to borrow from.

@Chris-Hibbert Chris-Hibbert force-pushed the 8672-acyclicZoeSeatKit branch 2 times, most recently from b2083b6 to a2a9c2a Compare February 28, 2024 20:34
@Chris-Hibbert Chris-Hibbert changed the base branch from master to 8868-gen-submissions February 28, 2024 20:35
@Chris-Hibbert
Copy link
Contributor Author

@erights,

#9010 provides a demonstration that the code gets called appropriately.

I'd like to merge this. What do you think?

@erights
Copy link
Member

erights commented Feb 28, 2024

I'd like to merge this. What do you think?

Is this PR staged on #9009 ? From

image

I would guess so. But it isn't approved yet. Can this PR be merged independent of the changes in #9009 ?

@erights
Copy link
Member

erights commented Feb 28, 2024

Note that I already approved. Once you're satisfied that #9009 shouldn't block this PR, feel free to merge.

Base automatically changed from 8868-gen-submissions to master February 29, 2024 23:57
@Chris-Hibbert Chris-Hibbert added the automerge:rebase Automatically rebase updates, then merge label Mar 1, 2024
@mergify mergify bot merged commit 7a91d1f into master Mar 1, 2024
74 checks passed
@mergify mergify bot deleted the 8672-acyclicZoeSeatKit branch March 1, 2024 01:02
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 performance Performance related issues resource-exhaustion Threats to availability from resource exhaustion attacks Zoe package: Zoe
Projects
None yet
Development

Successfully merging this pull request may close these issues.

define a new ZoeSeatKit that doesn't create cycles
2 participants