-
Notifications
You must be signed in to change notification settings - Fork 214
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
Conversation
59596b6
to
0fe0d3c
Compare
There was a problem hiding this 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.
It's mentioned under Testing Considerations, above, as missing.
I presume that manual inspection in a debugging environment would suffice, as I don't know how to add this to a regression test. |
I presume that manual inspection in a debugging environment would suffice, as I don't know how to add this to a regression test.
Yes
|
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()), | ||
}), | ||
}); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
cdc16b8
to
006df25
Compare
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. |
b2083b6
to
a2a9c2a
Compare
Note that I already approved. Once you're satisfied that #9009 shouldn't block this PR, feel free to merge. |
in zcfSeat.js: zcfSeatToSeatHandle.delete(self) in exit.js: state.zccfSeat = undefined
a2a9c2a
to
5d5722f
Compare
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
All existing tests in packages/zoe pass, with two tests requiring minor changes to error messages.
Upgrade Considerations
See above.