Skip to content

Commit

Permalink
fix: retry upgrade vaults price quote
Browse files Browse the repository at this point in the history
  • Loading branch information
mhofman committed Jun 26, 2024
1 parent b3182a4 commit ea568a2
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions packages/inter-protocol/src/proposals/upgrade-vaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { E } from '@endo/far';
import { makeNotifierFromAsyncIterable } from '@agoric/notifier';
import { AmountMath } from '@agoric/ertp/src/index.js';
import { makeTracer } from '@agoric/internal/src/index.js';
import { isUpgradeDisconnection } from '@agoric/internal/src/upgrade-api.js';

const trace = makeTracer('upgrade Vaults proposal');

Expand Down Expand Up @@ -150,9 +151,28 @@ export const upgradeVaults = async (powers, { options }) => {
// Wait for at least one new price feed to be ready before upgrading Vaults
void E.when(
any(
Object.values(vaultBrands).map(brand =>
E(priceAuthority).quoteGiven(AmountMath.make(brand, 10n), istBrand),
),
Object.values(vaultBrands).map(async brand => {
const getQuote = async lastRejectionReason => {
await null;
try {
return await E(priceAuthority).quoteGiven(
AmountMath.make(brand, 10n),
istBrand,
);
} catch (reason) {
if (
isUpgradeDisconnection(reason) &&
(!lastRejectionReason ||
reason.incarnationNumber >
lastRejectionReason.incarnationNumber)
) {
return getQuote(reason);
}
throw reason;
}
};
return getQuote(null);
}),
),
async price => {
trace(`upgrading after delay`, price);
Expand Down

0 comments on commit ea568a2

Please sign in to comment.