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

feat: add exit to empty seat #1584

Merged
merged 1 commit into from
Aug 27, 2020
Merged

Conversation

katelynsills
Copy link
Contributor

See #1582 for more discussion. I'm curious if we could implement the give portion too, using a reallocation.

I still need to add tests of the different userSeat methods to ensure the empty seat operates like a real seat in all ways.

Closes #1582

@katelynsills katelynsills added the Zoe package: Zoe label Aug 21, 2020
@katelynsills katelynsills self-assigned this Aug 21, 2020
Copy link
Contributor

@Chris-Hibbert Chris-Hibbert left a comment

Choose a reason for hiding this comment

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

This looks like it continues to conserve all our safety properties, but I don't understand its value.

Under what circumstances would a contract want to create an internal seat for which it needed an exit clause?

@katelynsills
Copy link
Contributor Author

This looks like it continues to conserve all our safety properties, but I don't understand its value.

Under what circumstances would a contract want to create an internal seat for which it needed an exit clause?

Many circumstances - for instance, if the seat should exit after a particular deadline. Or, if the userSeat facet will be handed to someone else such that the ability to exit is separated from the contract's ability to exit.

My point, though, is that the burden of proof has been in the wrong direction. We shouldn't be asking why seats should all act the same. We should be asking why some seats should have different functionality. I would like the empty seats to have the same functionality as other seats.

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.

I like the switching burden of proof argument. But it seems this PR is only a step along the way. The result is far from like a seat in all ways.

A seat whose want alone must be satisfied to preserve offer safety would take it farther from being just like a normal seat. I also don't see how it is a workable plan. The seat would start with an allocation that VIOLATES its offer safety. If the contract crashes in this state, offer safety would be violated. If the seat is exited in this state, what happens? Preventing the exit violates payout liveness.

So putting aside the burden-of-proof argument, it would help to actually have and try a concrete use case. The issues under even an artificial but concrete use case may be much easier to evaluate than under imagined use.

Was there a particular use case you had in mind that motivated this in the first place?

@katelynsills
Copy link
Contributor Author

I like the switching burden of proof argument. But it seems this PR is only a step along the way. The result is far from like a seat in all ways.

I think I disagree with this. The only way it is different is the offer cannot give anything. That's only one difference. An important difference, but it is the only one.

I view this PR as a step towards being able to give from the contract side. Potential solutions include either 1) being able to synchronously process payments from the contract to cover give (hard) or 2) being able to synchronously use reallocations to cover give (seems easier). Either way, this PR shows that our previous assumption that you cannot exit an empty seat was unnecessary.

A seat whose want alone must be satisfied to preserve offer safety would take it farther from being just like a normal seat. I also don't see how it is a workable plan. The seat would start with an allocation that VIOLATES its offer safety. If the contract crashes in this state, offer safety would be violated. If the seat is exited in this state, what happens? Preventing the exit violates payout liveness.

Yup, that makes sense.

So putting aside the burden-of-proof argument, it would help to actually have and try a concrete use case. The issues under even an artificial but concrete use case may be much easier to evaluate than under imagined use.
Was there a particular use case you had in mind that motivated this in the first place?

Yes, 1) the ability to exit an empty seat automatically afterDeadline and 2) to hand the userSeat to another entity such that they (who do not have access to the zcf seat) can exit on demand.

I think I will try to change this PR to allow the contract code to pass only the exit rule, so that the want and give are still empty under the hood. I want to push this PR forward because I think it does two important things: 1) allows all Seats to have uniform exitObjs based on the exit rule, and 2) shows how the proposal can be updated from the ZCF side, preparing the way in the future for us handling give correctly.

@erights
Copy link
Member

erights commented Aug 27, 2020

shows how the proposal can be updated from the ZCF side, preparing the way in the future for us handling give correctly.

By "updated" do you mean modified after creation? I don't think so, and your current code only provides proposal ingredients when the seat is constructed. This makes sense to me.

With that clarified, I look forward to the next version. Thanks.

@katelynsills
Copy link
Contributor Author

By "updated" do you mean modified after creation? I don't think so, and your current code only provides proposal ingredients when the seat is constructed. This makes sense to me.

No, sorry, updated is the wrong word. I mean created.

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

@@ -208,7 +208,7 @@
* @property {(brand: Brand) => Issuer} getIssuerForBrand
* @property {GetAmountMath} getAmountMath
* @property {MakeZCFMint} makeZCFMint
* @property {() => ZcfSeatKit} makeEmptySeatKit
* @property {(want: AmountKeywordRecord=, exit: ExitRule= }) => ZcfSeatKit} makeEmptySeatKit
Copy link
Member

Choose a reason for hiding this comment

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

Stale want:. Please remove.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point

offerResult: offerResultPromiseKit.promise,
exitObj: exitObjPromiseKit.promise,
},
exitObjPromiseKit.promise,
Copy link
Member

Choose a reason for hiding this comment

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

Didn't you already flatten this out in a previous PR? In any case, the flattening is good.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Whoops, I've got some rebasing to do, sorry.

@katelynsills katelynsills changed the title feat: add want, exit to empty seat feat: add exit to empty seat Aug 27, 2020
@katelynsills katelynsills marked this pull request as ready for review August 27, 2020 02:14
@katelynsills katelynsills merged commit ae303e1 into master Aug 27, 2020
@katelynsills katelynsills deleted the 1582-empty-seat-want-exit branch August 27, 2020 03:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Zoe package: Zoe
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow Empty Seat to Have a Proposal with Want, Exit
3 participants