Skip to content

Commit

Permalink
fix(zoe): Fix guards to accurately guard args
Browse files Browse the repository at this point in the history
  • Loading branch information
erights committed Dec 11, 2023
1 parent bc4a41c commit 9c3ea26
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
15 changes: 9 additions & 6 deletions packages/zoe/src/typeGuards.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,10 +276,12 @@ export const ZoeStorageManagerIKit = harden({
getBundleIDFromInstallation: M.call(InstallationShape).returns(
M.eref(M.string()),
),
installBundle: M.call(M.or(InstanceHandleShape, BundleShape)).returns(
M.promise(),
),
installBundleID: M.call(M.string()).returns(M.promise()),
installBundle: M.call(M.or(InstanceHandleShape, BundleShape))
.optional(M.string())
.returns(M.promise()),
installBundleID: M.call(M.string())
.optional(M.string())
.returns(M.promise()),

getPublicFacet: M.call(InstanceHandleShape).returns(
M.eref(M.remotable('PublicFacet')),
Expand Down Expand Up @@ -310,6 +312,7 @@ export const ZoeStorageManagerIKit = harden({
IssuerPKeywordRecordShape,
M.or(InstanceHandleShape, BundleShape),
M.or(BundleCapShape, BundleShape),
M.string(),
).returns(M.promise()),
unwrapInstallation: M.callWhen(M.eref(InstallationShape)).returns(
UnwrappedInstallationShape,
Expand All @@ -321,8 +324,8 @@ export const ZoeStorageManagerIKit = harden({
});

export const ZoeServiceI = M.interface('ZoeService', {
install: M.call(M.any()).returns(M.promise()),
installBundleID: M.call(M.string()).returns(M.promise()),
install: M.call(M.any()).optional(M.string()).returns(M.promise()),
installBundleID: M.call(M.string()).optional(M.string()).returns(M.promise()),
startInstance: M.call(M.eref(InstallationShape))
.optional(IssuerPKeywordRecordShape, M.any(), M.any())
.returns(M.promise()),
Expand Down
8 changes: 6 additions & 2 deletions packages/zoe/src/zoeService/installationStorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,12 @@ export const makeInstallationStorage = (getBundleCapForID, zoeBaggage) => {
InstanceHandleShape,
M.recordOf(M.string(), M.string({ stringLengthLimit: Infinity })),
),
).returns(M.promise()),
installBundleID: M.call(M.string()).returns(M.promise()),
)
.optional(M.string())
.returns(M.promise()),
installBundleID: M.call(M.string())
.optional(M.string())
.returns(M.promise()),
unwrapInstallation: M.callWhen(M.await(InstallationShape)).returns(
UnwrappedInstallationShape,
),
Expand Down

0 comments on commit 9c3ea26

Please sign in to comment.