From 72cc8d6bcf428596653593708959446fb0a29596 Mon Sep 17 00:00:00 2001 From: "Mark S. Miller" Date: Mon, 10 Jan 2022 17:46:43 -0800 Subject: [PATCH] fix: minor adjustments from purple day1 (#4271) --- packages/store/src/types.js | 7 ++++--- packages/zoe/src/typeGuards.js | 10 +++++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/packages/store/src/types.js b/packages/store/src/types.js index 7742eb450ab..8cb44cd18e2 100644 --- a/packages/store/src/types.js +++ b/packages/store/src/types.js @@ -47,7 +47,7 @@ * category of Amounts. And "AmountPatternShape" represents the * category of patterns over Amounts. * - * * I say "indended" above because Patterns, in order to be declarative + * * I say "intended" above because Patterns, in order to be declarative * and passable, cannot have the generality of predicates written in a * Turing-universal programming language. Rather, to represent the category of * things intended to be a Foo, a FooShape should reliably @@ -281,8 +281,9 @@ /** * @typedef {RankCompare} FullCompare - * A `FullCompare` function satisfies all the invariants stated above for - * `RankCompare`. In addition, its equality is as precise as the `KeyCompare` + * A `FullCompare` function satisfies all the invariants stated below for + * `RankCompare`'s relation with KeyCompare. + * In addition, its equality is as precise as the `KeyCompare` * comparison defined below, in that, for all Keys `x` and `y`, * `FullCompare(x, y) === 0` iff `KeyCompare(x, y) === 0`. * diff --git a/packages/zoe/src/typeGuards.js b/packages/zoe/src/typeGuards.js index 79c1b60ed98..393c0c7e5de 100644 --- a/packages/zoe/src/typeGuards.js +++ b/packages/zoe/src/typeGuards.js @@ -3,14 +3,18 @@ import { AmountShape } from '@agoric/ertp'; import { M } from '@agoric/store'; -export const AmountRecordKeywordShape = M.recordOf(M.string(), AmountShape); +export const AmountKeywordRecordShape = M.recordOf(M.string(), AmountShape); +export const AmountPatternKeywordRecordShape = M.recordOf( + M.string(), + M.pattern(), +); /** * After defaults are filled in */ export const ProposalShape = harden({ - want: M.recordOf(M.string(), M.pattern()), - give: AmountRecordKeywordShape, + want: AmountPatternKeywordRecordShape, + give: AmountKeywordRecordShape, // To accept only one, we could use M.or rather than M.partial, // but the error messages would have been worse. Rather, // cleanProposal's assertExit checks that there's exactly one.