From 61e619cce511f9ba6a9dcdf911695f83eeef017c Mon Sep 17 00:00:00 2001 From: "Mark S. Miller" Date: Wed, 19 Oct 2022 16:10:11 -0700 Subject: [PATCH] fix: tighten invitation proposal patterns --- packages/inter-protocol/src/psm/psm.js | 8 ++++++-- packages/inter-protocol/test/psm/test-psm.js | 6 +++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/inter-protocol/src/psm/psm.js b/packages/inter-protocol/src/psm/psm.js index b82942f018bc..066adb5b274f 100644 --- a/packages/inter-protocol/src/psm/psm.js +++ b/packages/inter-protocol/src/psm/psm.js @@ -275,9 +275,11 @@ export const start = async (zcf, privateArgs, baggage) => { wantmintedHook, 'wantMinted', undefined, - M.split({ + harden({ give: { In: anchorAmountShape }, want: M.or({ Out: stableAmountShape }, {}), + multiples: 1n, + exit: M.any(), }), ); }, @@ -286,9 +288,11 @@ export const start = async (zcf, privateArgs, baggage) => { giveMintedHook, 'giveMinted', undefined, - M.split({ + harden({ give: { In: stableAmountShape }, want: M.or({ Out: anchorAmountShape }, {}), + multiples: 1n, + exit: M.any(), }), ); }, diff --git a/packages/inter-protocol/test/psm/test-psm.js b/packages/inter-protocol/test/psm/test-psm.js index b8c3e40731b7..015a10447e77 100644 --- a/packages/inter-protocol/test/psm/test-psm.js +++ b/packages/inter-protocol/test/psm/test-psm.js @@ -624,7 +624,7 @@ test('wrong give giveMintedInvitation', async t => { ), { message: - '"giveMinted" proposal: required-parts: give: In: brand: "[Alleged: aUSD brand]" - Must be: "[Alleged: IST brand]"', + '"giveMinted" proposal: give: In: brand: "[Alleged: aUSD brand]" - Must be: "[Alleged: IST brand]"', }, ); }); @@ -654,7 +654,7 @@ test('wrong give wantMintedInvitation', async t => { ), { message: - '"wantMinted" proposal: required-parts: give: In: brand: "[Alleged: IST brand]" - Must be: "[Alleged: aUSD brand]"', + '"wantMinted" proposal: give: In: brand: "[Alleged: IST brand]" - Must be: "[Alleged: aUSD brand]"', }, ); }); @@ -676,7 +676,7 @@ test('extra give wantMintedInvitation', async t => { ), { message: - '"wantMinted" proposal: required-parts: give: {"Extra":{"brand":"[Alleged: aUSD brand]","value":"[200000000n]"},"In":{"brand":"[Seen]","value":"[200000000n]"}} - Must not have unexpected properties: ["Extra"]', + '"wantMinted" proposal: give: {"Extra":{"brand":"[Alleged: aUSD brand]","value":"[200000000n]"},"In":{"brand":"[Seen]","value":"[200000000n]"}} - Must not have unexpected properties: ["Extra"]', }, ); });