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

fix: psmCharter.addInstance interface shape correction #6202

Merged
merged 2 commits into from
Sep 15, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions packages/inter-protocol/src/psm/psmCharter.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,9 @@ export const start = async zcf => {
};

const psmCharterCreatorI = M.interface('PSM Charter creatorFacet', {
addInstance: M.call(
InstanceHandleShape,
M.any(),
BrandShape,
BrandShape,
).returns(),
addInstance: M.call(InstanceHandleShape, M.any())
.optional(BrandShape, BrandShape)
Copy link
Member

Choose a reason for hiding this comment

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

TIL .optional. Where is it documented or implemented?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's very little documentation. I dunno where the implementations are. It's tested in test-heap-classes.

Copy link
Member

@turadg turadg Sep 14, 2022

Choose a reason for hiding this comment

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

Yeah, that documentation doesn't mention optional. I've filed #6206 cc @erights

Copy link
Member

Choose a reason for hiding this comment

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

From #6206 (comment) :

FWIW, this is implemented at

optional: (...optArgGuards) => {
optionalArgGuards === undefined ||
assert.fail(X`Can only have one set of optional guards`);
restArgGuard === undefined ||
assert.fail(X`optional arg guards must come before rest arg`);
return makeMethodGuardMaker(callKind, argGuards, optArgGuards);
},
and used several times in https://github.com/Agoric/agoric-sdk/blob/master/packages/ERTP/src/typeGuards.js

I'm actually surprised I didn't write any comments explaining this at all. I certainly agree it is needed.

Also rest

.returns(),
makeCharterMemberInvitation: M.call().returns(M.promise()),
});

Expand Down