Skip to content

Commit

Permalink
test: A3P only has ATOM and stTIA. drop unknown tokens
Browse files Browse the repository at this point in the history
This PR had been trying to add stTIA, stOSMO and stkATOM to the list
of brands in A3P, to match those in mainNet, but that was a
mistake. This drops those.  It was previously adding priceFeeds,
but not scaledPriceAuthorities.
  • Loading branch information
Chris-Hibbert committed Aug 1, 2024
1 parent 5cce437 commit 97fa744
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 33 deletions.
31 changes: 21 additions & 10 deletions a3p-integration/proposals/a:upgrade-next/upgradeVaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,35 @@ import {
pushPrices,
registerOraclesForBrand,
} from './agd-tools.js';
import { getDetailsMatchingVats } from './vatDetails.js';

const BRANDNAMES = ['ATOM', 'stATOM', 'stTIA', 'stOSMO', 'stkATOM'];
const BRANDNAMES = ['ATOM', 'stATOM'];
const oraclesByBrand = generateOracleMap('u16', BRANDNAMES);

// There are no old prices for the other currencies.
const atomOutPre = await getPriceQuote('ATOM');
assert.equal(atomOutPre, '+12010000');

console.log('adding oracle for each brand');
console.log('UPGV: adding oracle for each brand');
await registerOraclesForBrand('ATOM', oraclesByBrand);
await registerOraclesForBrand('stATOM', oraclesByBrand);
await registerOraclesForBrand('stTIA', oraclesByBrand);
await registerOraclesForBrand('stOSMO', oraclesByBrand);
await registerOraclesForBrand('stkATOM', oraclesByBrand);

console.log('pushing new prices');
console.log('UPGV: pushing new prices');
await pushPrices(11.2, 'ATOM', oraclesByBrand);
await pushPrices(11.3, 'stTIA', oraclesByBrand);
await pushPrices(11.4, 'stATOM', oraclesByBrand);
await pushPrices(11.5, 'stOSMO', oraclesByBrand);
await pushPrices(11.6, 'stkATOM', oraclesByBrand);

// price_feed and governor, old and new for two tokens
const priceFeedDetails = await getDetailsMatchingVats('price_feed');
assert.equal(Object.keys(priceFeedDetails).length, 8);

// Two old SPAs, and two new ones
const details = await getDetailsMatchingVats('scaledPriceAuthority');
assert.equal(Object.keys(details).length, 4, Object.keys(details));
console.log('UPGV 8 price feeds and 4 scaledPriceAuthorities found');

// We previously created price feeds for some tokens that aren't in A3P
const osmoDetails = await getDetailsMatchingVats('stOSMO');
assert.equal(Object.keys(osmoDetails).length, 0);
const tiaDetails = await getDetailsMatchingVats('stTIA');
assert.equal(Object.keys(tiaDetails).length, 0);
const stkAtomDetails = await getDetailsMatchingVats('stkATOM');
assert.equal(Object.keys(stkAtomDetails).length, 0);
24 changes: 3 additions & 21 deletions a3p-integration/proposals/a:upgrade-next/upgradeVaults.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,39 +23,21 @@ import {
import { getDetailsMatchingVats } from './vatDetails.js';

const checkPriceFeedVatsUpdated = async t => {
const atomDetails = await getVatDetails('ATOM-USD_price_feed');
const atomDetails = await getVatDetails('-ATOM-USD_price_feed');
// both the original and the new ATOM vault are incarnation 0
t.is(atomDetails.incarnation, 0);
const stAtomDetails = await getVatDetails('stATOM');
t.is(stAtomDetails.incarnation, 0);
const stOsmoDetails = await getVatDetails('stOSMO');
t.is(stOsmoDetails.incarnation, 0);
const stTiaDetails = await getVatDetails('stTIA');
t.is(stTiaDetails.incarnation, 0);
await Promise.all([
checkForOracle(t, 'ATOM'),
checkForOracle(t, 'stATOM'),
checkForOracle(t, 'stTIA'),
checkForOracle(t, 'stOSMO'),
checkForOracle(t, 'stkATOM'),
]);
await Promise.all([checkForOracle(t, 'ATOM'), checkForOracle(t, 'stATOM')]);
};

const BRANDNAMES = ['ATOM', 'stATOM', 'stTIA', 'stOSMO', 'stkATOM'];
const BRANDNAMES = ['ATOM', 'stATOM'];
const oraclesByBrand = generateOracleMap('u16', BRANDNAMES);

const checkNewQuotes = async t => {
t.log('awaiting new quotes');
const atomOut = await getPriceQuote('ATOM');
t.is(atomOut, '+11200000');
const tiaOut = await getPriceQuote('stTIA');
t.is(tiaOut, '+11300000');
const stAtomOut = await getPriceQuote('stATOM');
t.is(stAtomOut, '+11400000');
const osmoOut = await getPriceQuote('stOSMO');
t.is(osmoOut, '+11500000');
const stkAtomOut = await getPriceQuote('stkATOM');
t.is(stkAtomOut, '+11600000');
};

const createNewBid = async t => {
Expand Down
3 changes: 2 additions & 1 deletion a3p-integration/proposals/a:upgrade-next/vatDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,11 @@ export const getDetailsMatchingVats = async vatName => {
const infos = [];
for (const vatID of vatIDs) {
const vatInfo = kStore.lookupVat(vatID);
const name = vatInfo.options().name;
const source = vatInfo.source();
// @ts-expect-error cast
const { incarnation } = vatInfo.currentSpan();
infos.push({ vatName, vatID, incarnation, ...source });
infos.push({ vatName: name, vatID, incarnation, ...source });
}

return infos;
Expand Down
7 changes: 6 additions & 1 deletion golang/cosmos/app/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,12 @@ func upgradePriceFeedCoreProposalSteps(upgradeName string) ([]vm.CoreProposalSte

var inBrandNames []string
switch {
case isThisUpgrade("UNRELEASED_A3P_INTEGRATION"), isThisUpgrade("UNRELEASED_main"):
case isThisUpgrade("UNRELEASED_A3P_INTEGRATION"):
inBrandNames = []string{
"ATOM",
"stATOM",
}
case isThisUpgrade("UNRELEASED_main"):
inBrandNames = []string{
"ATOM",
"stATOM",
Expand Down

0 comments on commit 97fa744

Please sign in to comment.