-
Notifications
You must be signed in to change notification settings - Fork 215
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
8606 invite proposals #10719
8606 invite proposals #10719
Conversation
3a52442
to
cd810ec
Compare
Deploying agoric-sdk with Cloudflare Pages
|
cd810ec
to
f75a179
Compare
@@ -367,7 +367,7 @@ export const ZoeServiceI = M.interface('ZoeService', { | |||
}), | |||
getInvitationDetails: M.call(M.eref(InvitationShape)).returns(M.any()), | |||
getProposalShapeForInvitation: M.call(InvitationHandleShape).returns( | |||
M.opt(ProposalShape), | |||
M.opt(M.pattern()), |
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.
why does getProposalShapeForInvitation
return values other than a ProposalShape?
Is ProposalShape
wrong?
I notice that getProposalShapeForInvitation
typedef returns Pattern | undefined
but some places then require that it be narrower than Pattern:
agoric-sdk/packages/zoe/src/zoeService/offer/offer.js
Lines 45 to 50 in 322023f
const proposalShape = | |
offerDataAccess.getProposalShapeForInvitation(invitationHandle); | |
if (proposalShape !== undefined) { | |
mustMatch(proposal, proposalShape, `${q(description)} proposal`); | |
} | |
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.
Different meta-levels: proposalShape
is the type for something that is shaped like a proposal. E(zoe).offer(invitation, proposal)
takes a proposal, and its guard requires that it match proposalShape
.
const proposal = harden({
give: { B: moola(5n) },
exit: { onDemand: null },
});
E(zoe).offer(invitation, proposal, { B: fiveMoola });
The object returned by getProposalShapeForInvitation(invitationHandle)
describes a proposal. It's a pattern
.
const proposalShape = M.splitRecord({
give: { B: AmountShape },
exit: { deadline: M.any() },
});
const invitation = await zcf.makeInvitation(
boring,
'seat1',
{},
proposalShape,
);
const { handle } = await E(zoe).getInvitationDetails(invitation);
const shape = await E(zoe).getProposalShapeForInvitation(handle);
t.deepEqual(shape, proposalShape);
It's arguable whether getProposalShapeForInvitation
should return a ProposalShapePattern
, but I don't think it's possible to customize M.pattern()
.
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.
Thanks for explaining. I agree Pattern
is the right type but I request that getProposalShapeForInvitation
get a jsdoc explaining its return type. A good time also to inline GetProposalShapeForInvitation
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
f75a179
to
f7b444c
Compare
This pull request has been removed from the queue for the following reason: Pull request #10719 has been dequeued. The pull request rule doesn't match anymore. The following conditions don't match anymore:
You should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it. If you want to requeue this pull request, you need to post a comment with the text: |
cfb3a62
to
bff77ff
Compare
correct one typeGuard improve jsdoc Also noticed that the types documented for getProposalShapeForInvitation were incorrect. fixed that with Agoric/documentation#1258
bff77ff
to
6cd9b9a
Compare
closes: #8606
closes: #8597
Description
#8597 suggested adding a test proposal guards in Zoe. This adds that test, and also cleans up a redundant check in coveredCall. The added test exposed a mistake in the Zoe doc, so 1258 fixes that as well.
Security Considerations
None
Scaling Considerations
None.
Documentation Considerations
Improved documentation.
Testing Considerations
Added tests.
Upgrade Considerations
These changes do not impact code on-chain. There's a correction to an example contract, an improvement in a TypeGuard, and a documentation update which will be separately release.