You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(patterns): M.containerHas(el,n) to support want patterns (#2710)
Closes: #XXXX
Refs: #2002#2008#2113#1739Agoric/agoric-sdk#10952
## Description
This PR adds a new `M.containerHas(elementPatt, positiveBigint)`
matcher, and exported `containerHasSplit` function. This is motivated to
support Agoric/agoric-sdk#10952 , which
introduces a minimal form of want pattern in terms of `M.containerHas`.
- [x] Actually merging this must happen only after we've decided either
to move forward with #2008 or to give up on it. Once a decision is made,
and even before it is acted on, then this PR can move forward. (Any
decision to move forward or not with #2008 should also consider changing
the default of the feature flag introduced by #2002 .)
### Security Considerations
none
### Scaling Considerations
Might help due to early termination of the split operations, which
Agoric/agoric-sdk#10952 uses for
`AmountMath.isGTE`.
### Documentation Considerations
Already doc-documents `M.containerHas` in the types.js file for `M`.
That's probably good enough for this PR. The interesting documentation
will be explaining want patterns in
Agoric/agoric-sdk#10952
### Testing Considerations
Added tests for `M.containerHas`
### Compatibility Considerations
The reason to postpone merging this PR until decisions are made on #2008
is that this PR will further expose `rankOrder` in the API, amplifying
the danger that changing the string order will cause surprising
observable changes.
### Upgrade Considerations
This PR itself does not introduce any BREAKING changes or Upgrade
issues.
- [x] Update `NEWS.md` for user-facing changes.
Copy file name to clipboardexpand all lines: packages/patterns/NEWS.md
+5
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,10 @@
1
1
User-visible changes in `@endo/patterns`:
2
2
3
+
# Next release
4
+
5
+
- New pattern: `M.containerHas(elementPatt, bound = 1n)` motivated to support want patterns in Zoe, to pull out only `bound` number of elements that match `elementPatt`. `bound` must be a positive bigint.
6
+
- Closely related, `@endo/patterns` now exports `containerHasSplit` to support ERTP's use of `M.containerHas` on non-fungible (`set`, `copySet`) and semifungible (`copyBag`) assets, respectively. See https://github.com/Agoric/agoric-sdk/pull/10952 .
7
+
3
8
# v1.4.0 (2024-05-06)
4
9
5
10
-`Passable` is now an accurate type instead of `any`. Downstream type checking may require changes ([example](https://github.com/Agoric/agoric-sdk/pull/8774))
0 commit comments