@agoric/inter-protocol 0.17.0-u18.2 → 0.17.0-u18.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/inter-protocol",
3
- "version": "0.17.0-u18.2",
3
+ "version": "0.17.0-u18.3",
4
4
  "description": "Core cryptoeconomy contracts",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -38,7 +38,7 @@
38
38
  "@agoric/store": "^0.9.3-u18.0",
39
39
  "@agoric/time": "^0.3.3-u18.0",
40
40
  "@agoric/vat-data": "^0.5.3-u18.0",
41
- "@agoric/vats": "^0.16.0-u18.2",
41
+ "@agoric/vats": "^0.16.0-u18.3",
42
42
  "@agoric/zoe": "^0.26.3-u18.0",
43
43
  "@endo/captp": "^4.4.2",
44
44
  "@endo/errors": "^1.2.7",
@@ -50,7 +50,7 @@
50
50
  "jessie.js": "^0.3.4"
51
51
  },
52
52
  "devDependencies": {
53
- "@agoric/smart-wallet": "^0.5.4-u18.2",
53
+ "@agoric/smart-wallet": "^0.5.4-u18.3",
54
54
  "@agoric/swingset-liveslots": "^0.10.3-u18.0",
55
55
  "@agoric/swingset-vat": "^0.33.0-u18.0",
56
56
  "@agoric/zone": "^0.3.0-u18.0",
@@ -84,5 +84,5 @@
84
84
  "typeCoverage": {
85
85
  "atLeast": 95.8
86
86
  },
87
- "gitHead": "431b36a49f8574ce49c29d152bf0ace03eb5a348"
87
+ "gitHead": "793783b3b1ff6b47565a959cb7ba60a1835e2486"
88
88
  }
@@ -59,7 +59,7 @@ export function prepareAuctionBook(baggage: Baggage, zcf: ZCF, makeRecorderKit:
59
59
  exitAfterBuy?: boolean | undefined;
60
60
  }): void;
61
61
  publishBookData(): Promise<void>;
62
- observeQuoteNotifier(): void;
62
+ ensureQuoteNotifierObserved(): void;
63
63
  };
64
64
  self: {
65
65
  /**
@@ -1 +1 @@
1
- {"version":3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YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,GAAG,CACE;IACE,UAAU,EAAE,KAAK,CAAC;CACnB,GACD;IACE,eAAe,EAAE,KAAK,CAAC;CACxB,CACJ;;;;;gBAyBQ,KAAK,GAAG,IAAI;;;;;uBACZ,KAAK,GAAG,IAAI;;;;;uBAEZ,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI;;;;;2BAEpB,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI;;;;;oBAEpB,MAAM,CAAC,KAAK,CAAC,GAAG,SAAS;;;;;qBAEzB,MAAM,CAAC,KAAK,CAAC;;;;;yBAEb,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI;;0BA4qBpB,UAAU,CAAC,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC;6BA1vBrC,kBAAkB;oCACX,4BAA4B"}
@@ -118,6 +118,8 @@ export const makeOfferSpecShape = (bidBrand, collateralBrand) => {
118
118
  export const prepareAuctionBook = (baggage, zcf, makeRecorderKit) => {
119
119
  const makeScaledBidBook = prepareScaledBidBook(baggage);
120
120
  const makePriceBook = preparePriceBook(baggage);
121
+ // Brands that have or are making active quoteNotifier Observers
122
+ const observedBrands = new Set();
121
123
 
122
124
  const AuctionBookStateShape = harden({
123
125
  collateralBrand: M.any(),
@@ -454,38 +456,59 @@ export const prepareAuctionBook = (baggage, zcf, makeRecorderKit) => {
454
456
  });
455
457
  return state.bookDataKit.recorder.write(bookData);
456
458
  },
457
- observeQuoteNotifier() {
459
+ // Ensure that there is an observer monitoring the quoteNotifier. We
460
+ // assume that all failure modes for quoteNotifier eventually lead to
461
+ // fail or finish.
462
+ ensureQuoteNotifierObserved() {
458
463
  const { state, facets } = this;
459
464
  const { collateralBrand, bidBrand, priceAuthority } = state;
460
465
 
466
+ if (observedBrands.has(collateralBrand)) {
467
+ return;
468
+ }
469
+ observedBrands.add(collateralBrand);
461
470
  trace('observing');
462
471
 
463
- const quoteNotifier = E(priceAuthority).makeQuoteNotifier(
472
+ const quoteNotifierP = E(priceAuthority).makeQuoteNotifier(
464
473
  AmountMath.make(collateralBrand, QUOTE_SCALE),
465
474
  bidBrand,
466
475
  );
467
- void observeNotifier(quoteNotifier, {
468
- updateState: quote => {
469
- trace(
470
- `BOOK notifier ${priceFrom(quote).numerator.value}/${
471
- priceFrom(quote).denominator.value
472
- }`,
473
- );
474
- state.updatingOracleQuote = priceFrom(quote);
475
- },
476
- fail: reason => {
477
- trace(`Failure from quoteNotifier (${reason}) setting to null`);
478
- // lack of quote will trigger restart
479
- state.updatingOracleQuote = null;
480
- },
481
- finish: done => {
482
- trace(
483
- `quoteNotifier invoked finish(${done}). setting quote to null`,
484
- );
485
- // lack of quote will trigger restart
476
+
477
+ void E.when(
478
+ quoteNotifierP,
479
+ quoteNotifier =>
480
+ observeNotifier(quoteNotifier, {
481
+ updateState: quote => {
482
+ trace(
483
+ `BOOK notifier ${priceFrom(quote).numerator.value}/${
484
+ priceFrom(quote).denominator.value
485
+ }`,
486
+ );
487
+ state.updatingOracleQuote = priceFrom(quote);
488
+ },
489
+ fail: reason => {
490
+ trace(
491
+ `Failure from quoteNotifier (${reason}) setting to null`,
492
+ );
493
+ // lack of quote will trigger restart
494
+ state.updatingOracleQuote = null;
495
+ observedBrands.delete(collateralBrand);
496
+ },
497
+ finish: done => {
498
+ trace(
499
+ `quoteNotifier invoked finish(${done}). setting quote to null`,
500
+ );
501
+ // lack of quote will trigger restart
502
+ state.updatingOracleQuote = null;
503
+ observedBrands.delete(collateralBrand);
504
+ },
505
+ }),
506
+ e => {
507
+ trace('makeQuoteNotifier failed, resetting', e);
486
508
  state.updatingOracleQuote = null;
509
+ observedBrands.delete(collateralBrand);
487
510
  },
488
- });
511
+ );
489
512
 
490
513
  void facets.helper.publishBookData();
491
514
  },
@@ -645,8 +668,9 @@ export const prepareAuctionBook = (baggage, zcf, makeRecorderKit) => {
645
668
 
646
669
  trace(`capturing oracle price `, state.updatingOracleQuote);
647
670
  if (!state.updatingOracleQuote) {
648
- // if the price has feed has died, try restarting it.
649
- facets.helper.observeQuoteNotifier();
671
+ // if the price feed has died (or hasn't been started for this
672
+ // incarnation), (re)start it.
673
+ facets.helper.ensureQuoteNotifierObserved();
650
674
  return;
651
675
  }
652
676
 
@@ -750,7 +774,7 @@ export const prepareAuctionBook = (baggage, zcf, makeRecorderKit) => {
750
774
  const { collateralBrand, bidBrand, priceAuthority } = state;
751
775
  assertAllDefined({ collateralBrand, bidBrand, priceAuthority });
752
776
 
753
- facets.helper.observeQuoteNotifier();
777
+ facets.helper.ensureQuoteNotifierObserved();
754
778
  },
755
779
  stateShape: AuctionBookStateShape,
756
780
  },