Skip to content

Commit

Permalink
chore(smart-wallet): less noisy watch outcome (#10515)
Browse files Browse the repository at this point in the history
closes: #10513

## Description
Use `when` instead of `asPromise` in the smart-wallet offer outcome logic. Reduce noise on upgrades for disconnected promises which are not actually used for production logic.

### Security Considerations

None

### Scaling Considerations

Removes some unnecessary watch bookkepping.

### Documentation Considerations
None. Added a comment for maintainers explaining the choice of `when`.

### Testing Considerations
Expecting existing tests to keep passing. The only functional difference is the removal of an unnecessary warning diagnostic.

### Upgrade Considerations

Requires an upgrade of the walletFactory vat.
  • Loading branch information
mhofman authored Nov 18, 2024
1 parent 7390224 commit 98e940d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/smart-wallet/src/offerWatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,18 @@ const watchForPayout = ({ paymentWatcher }, seat) => {
/** @param {VowTools} vowTools */
export const makeWatchOfferOutcomes = vowTools => {
const watchForOfferResult = makeWatchForOfferResult(vowTools);
const { asPromise, allVows } = vowTools;
const { when, allVows } = vowTools;
/**
* @param {OutcomeWatchers} watchers
* @param {UserSeat} seat
*/
const watchOfferOutcomes = (watchers, seat) => {
return asPromise(
// Use `when` to get a promise from the vow.
// Unlike `asPromise` this doesn't warn in case of disconnections, which is
// fine since we actually handle the outcome durably through the watchers.
// Only the `executeOffer` caller relies on the settlement of this promise,
// and only in tests.
return when(
allVows([
watchForOfferResult(watchers, seat),
watchForNumWants(watchers, seat),
Expand Down

0 comments on commit 98e940d

Please sign in to comment.