Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repair u19 tests in a3p-integration #10947

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions a3p-integration/proposals/n:upgrade-next/.gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1 @@
replaceFeeDistributor/
addUsdLemons/
addUsdOlives/
upgradeProvisionPool/
upgradeAgoricNames/
publishTestInfo/
upgrade-mintHolder/
upgradeAssetReserve/
upgradePSM/
test/generated/
2 changes: 2 additions & 0 deletions a3p-integration/proposals/n:upgrade-next/eval.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

set -euo pipefail

# evaluate the proposals in the /submission/ directory

echo "UPGRADE-19 Running proposal declared in package.json"
Expand Down
13 changes: 3 additions & 10 deletions a3p-integration/proposals/n:upgrade-next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,9 @@
},
"type": "Software Upgrade Proposal",
"sdk-generate": [
"testing/replace-feeDistributor-short.js replaceFeeDistributor",
"testing/add-USD-LEMONS.js addUsdLemons",
"vats/upgrade-provisionPool.js upgradeProvisionPool",
"vats/upgrade-asset-reserve.js upgradeAssetReserve",
"vats/upgrade-psm.js upgradePSM",
"vats/upgrade-paRegistry.js",
"vats/upgrade-agoricNames.js agoricNamesCoreEvals/upgradeAgoricNames",
"testing/add-USD-OLIVES.js agoricNamesCoreEvals/addUsdOlives",
"testing/publish-test-info.js agoricNamesCoreEvals/publishTestInfo",
"vats/upgrade-mintHolder.js upgrade-mintHolder A3P_INTEGRATION"
"testing/add-USD-LEMONS.js test/generated/addUsdLemons",
"testing/add-USD-OLIVES.js test/generated/agoricNamesCoreEvals/addUsdOlives",
"testing/publish-test-info.js test/generated/agoricNamesCoreEvals/publishTestInfo"
]
},
"type": "module",
Expand Down
81 changes: 0 additions & 81 deletions a3p-integration/proposals/n:upgrade-next/psm.test.js

This file was deleted.

15 changes: 8 additions & 7 deletions a3p-integration/proposals/n:upgrade-next/test.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#!/bin/bash

yarn ava initial.test.js
yarn ava replaceFeeDistributor.test.js
yarn ava mintHolder.test.js
yarn ava provisionPool.test.js
set -euo pipefail

turadg marked this conversation as resolved.
Show resolved Hide resolved
# segregate so changing these does not invalidate the proposal image
# à la https://github.com/Agoric/agoric-3-proposals/pull/213
cd test

yarn ava agoricNames.test.js
GLOBIGNORE=initial.test.js
yarn ava initial.test.js

yarn ava assetReserve.test.js
yarn ava psm.test.js
yarn ava *.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,10 @@
import { getBalances, listVaults } from './test-lib/utils.js';
import { walletUtils } from './test-lib/index.js';

const AGORIC_NAMES_UPGRADE_DIR = 'agoricNamesCoreEvals/upgradeAgoricNames';
const WRITE_AGORIC_NAMES_DIR = 'agoricNamesCoreEvals/writeToAgoricNames';
const ADD_USD_OLIVES_DIR = 'agoricNamesCoreEvals/addUsdOlives';
const ADD_USD_OLIVES_DIR = 'generated/agoricNamesCoreEvals/addUsdOlives';
const DEPOSIT_USD_OLIVES_DIR = 'agoricNamesCoreEvals/depositUsdOlives';
const PUBLISH_TEST_INFO_DIR = 'agoricNamesCoreEvals/publishTestInfo';
const PUBLISH_TEST_INFO_DIR = 'generated/agoricNamesCoreEvals/publishTestInfo';
const WRITE_TEST_INFO_DIR = 'agoricNamesCoreEvals/writeToTestInfo';

const makeWaitUntilKeyFound = (keyFinder, vstorage) => (path, targetKey) =>
Expand Down Expand Up @@ -118,9 +117,7 @@
});
});

test.serial('upgrade agoricNames', async t => {
await evalBundles(AGORIC_NAMES_UPGRADE_DIR);

test.serial('verify incarnation', async t => {
const incarnation = await getIncarnation('agoricNames');
t.is(incarnation, 1, 'incorrect incarnation');
});
Expand Down Expand Up @@ -155,7 +152,7 @@
const agoricNamesAfter = await getAgoricNames();
t.like(agoricNamesAfter, agoricNamesBefore);

agoricNamesChildren.forEach(child =>

Check warning on line 155 in a3p-integration/proposals/n:upgrade-next/test/agoricNames.test.js

View workflow job for this annotation

GitHub Actions / lint-rest

Prefer for...of instead of Array.forEach
assert(
agoricNamesAfter[child][`test${child}`],
'we should be able to add new value',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ import {
waitUntilContractDeployed,
} from '@agoric/client-utils';

const ADD_PSM_DIR = 'addUsdLemons';
const UPGRADE_AR_DIR = 'upgradeAssetReserve';
const ADD_PSM_DIR = 'generated/addUsdLemons';
const ADD_COLLATERAL = 'addCollateral';

const ambientAuthority = {
Expand Down Expand Up @@ -51,11 +50,10 @@ test.before(async t => {
};
});

test.serial('add collatoral to reserve', async t => {
test.serial('add Collateral to reserve', async t => {
// @ts-expect-error casting
const { vstorageKit } = t.context;

// Introduce USD_LEMONS
await evalBundles(ADD_PSM_DIR);
await waitUntilContractDeployed('psm-IST-USD_LEMONS', ambientAuthority, {
errorMessage: 'psm-IST-USD_LEMONS instance not observed.',
Expand All @@ -75,8 +73,6 @@ test.serial('upgrade', async t => {
// @ts-expect-error casting
const { vstorageKit } = t.context;

await evalBundles(UPGRADE_AR_DIR);

const vatDetailsAfter = await getDetailsMatchingVats('reserve');
const { incarnation } = vatDetailsAfter.find(vat => vat.vatID === 'v36'); // assetReserve is v36

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const vats = {
orchestration: { incarnation: 1 },
transfer: { incarnation: 2 },
walletFactory: { incarnation: 6 },
zoe: { incarnation: 4 },
zoe: { incarnation: 3 },
// Terminated in a future proposal.
'-ATOM-USD_price_feed-governor': { incarnation: 0 },
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ const sendBankAsset = async powers => {
const valueStr = '{{VALUE}}';
const value = BigInt(valueStr)

console.log(`Start sendBankAsset for ${label}`);

const contractKits = await contractKitsP;
const mintHolderKit = Array.from(contractKits.values()).filter(
kit => kit.label && kit.label === label,
Expand All @@ -49,8 +47,6 @@ const sendBankAsset = async powers => {
);

await E(receiverDepositFacet).receive(payment);

console.log(`Finished sendBankAsset for ${label}`);
};

sendBankAsset;
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ import {
getAssetList,
swap,
getPSMChildren,
upgradeMintHolder,
} from './test-lib/mintHolder-helpers.js';
import { networkConfig } from './test-lib/index.js';

test('mintHolder contract is upgraded', async t => {
test('verify mintHolder contract upgrade', async t => {
const receiver = await addUser('receiver');
await provisionSmartWallet(receiver, `20000000ubld`);

let assetList = await getAssetList();
t.log('List of mintHolder vats being upgraded: ', assetList);
await upgradeMintHolder(`upgrade-mintHolder`, assetList);
await mintPayment(t, receiver, assetList, 10);
// The FastLP mint is not in a mintHolder; it's a ZCFMint from the FastUSDC contract
const assetListNoFastUSDC = assetList.filter(x => x.label !== 'FastLP');
await mintPayment(t, receiver, assetListNoFastUSDC, 10);

const psmLabelList = await getPSMChildren(fetch, networkConfig);
assetList = await getAssetList(psmLabelList);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,15 @@ const nullUpgradePP = async powers => {
},
} = powers;

console.log('awaiting powers');
const { adminFacet, instance } = await provisionPoolStartResultP;
const instancePrivateArgs = await instancePrivateArgsP;

console.log('get privateArgs');
const privateArgs = instancePrivateArgs.get(instance);
const [poolBank, poserInvitation] = await Promise.all([
privateArgs.poolBank,
E(economicCommitteeCreatorFacet).getPoserInvitation(),
]);

console.log('DEBUG', {
adminFacet,
instance,
privateArgs,
poserInvitation,
});

await E(adminFacet).restartContract({
...privateArgs,
poolBank,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
* - https://github.com/Agoric/agoric-sdk/issues/8724
*
* The test scenario is as follows;
* 1. Upgrade provisionPool. This upgrade overrides provisionWalletBridgerManager with a durable one
* 1. Upgrade provisionPool in upgrade.go. This upgrade overrides
* provisionWalletBridgerManager with a durable one
* 2. Add a new account and successfully provision it
* - Observe new account's address under `published.wallet.${address}`
* 3. Send some USDC_axl to provisionPoolAddress and observe its IST balances increases accordingly
Expand Down Expand Up @@ -54,9 +55,7 @@ import { getIncarnationFromDetails } from './test-lib/utils.js';

const PROVISIONING_POOL_ADDR = 'agoric1megzytg65cyrgzs6fvzxgrcqvwwl7ugpt62346';

const ADD_PSM_DIR = 'addUsdLemons';
const DEPOSIT_USD_LEMONS_DIR = 'depositUSD-LEMONS';
const UPGRADE_PP_DIR = 'upgradeProvisionPool';
const NULL_UPGRADE_PP_DIR = 'nullUpgradePP';

const USDC_DENOM = NonNullish(process.env.USDC_DENOM);
Expand Down Expand Up @@ -87,24 +86,6 @@ test.before(async t => {
};
});

test.serial('upgrade provisionPool', async t => {
// @ts-expect-error casting
const { currentVatIncarnations } = t.context;
console.log(currentVatIncarnations);
await evalBundles(UPGRADE_PP_DIR);

for await (const vatName of upgradedVats) {
const incarnationAfterUpgrade = await getIncarnationFromDetails(vatName);
const previousIncarnation = currentVatIncarnations[vatName];

t.is(
incarnationAfterUpgrade,
previousIncarnation + 1,
`${vatName} does not meet the expected incarnation number`,
);
}
});

test.serial(
`check provisionPool can recover purse and asset subscribers after upgrade`,
async t => {
Expand All @@ -127,8 +108,8 @@ test.serial(
{ errorMessage: 'Provision pool not able to swap USDC_axl for IST.' },
);

// Introduce USD_LEMONS
await evalBundles(ADD_PSM_DIR);
// agoricNames already added USD_LEMONS
// await evalBundles(ADD_PSM_DIR);
await waitUntilContractDeployed('psm-IST-USD_LEMONS', ambientAuthority, {
errorMessage: 'psm-IST-USD_LEMONS instance not observed.',
});
Expand Down
60 changes: 60 additions & 0 deletions a3p-integration/proposals/n:upgrade-next/test/psm.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/* eslint-env node */
/**
* @file The goal of this file is to make sure all the PSM contacts were
* upgraded. Each set of vats are different per chain, but for mainnet, we
* expect this to be: V37-V42, V73, V76
*
* The test scenario is as follows;
* 1. Verify metrics before the upgrade
* 2. Verify trading is possible after the upgrade
*/

import '@endo/init';
import test from 'ava';
import { evalBundles } from '@agoric/synthetic-chain';
import { makeVstorageKit } from '@agoric/client-utils';

const SWAP_ANCHOR = 'swapAnchorForMintedSeat';

test.before(async t => {
const vstorageKit = await makeVstorageKit(
{ fetch },
{ rpcAddrs: ['http://localhost:26657'], chainName: 'agoriclocal' },
);

t.context = {
vstorageKit,
};
});

test.serial('check stats pre-swap', async t => {
// @ts-expect-error casting
const { vstorageKit } = t.context;

const metrics = await vstorageKit.readLatestHead(
'published.psm.IST.USDC.metrics',
);

t.is(metrics.anchorPoolBalance.value, 0n, 'anchorPool empty');
t.is(metrics.feePoolBalance.value, 0n, 'feePool empty');
t.is(metrics.mintedPoolBalance.value, 0n, 'mintedPool 500K');
t.is(metrics.totalAnchorProvided.value, 0n, 'totalAnchor empty');
t.is(metrics.totalMintedProvided.value, 0n, 'totalMinted 500K');
});

test.serial('verify trading after upgrade', async t => {
// @ts-expect-error casting
const { vstorageKit } = t.context;

await evalBundles(SWAP_ANCHOR);

const metrics = await vstorageKit.readLatestHead(
'published.psm.IST.USDC.metrics',
);

t.is(metrics.anchorPoolBalance.value, 500_000n, 'AnchorPool +500K');
t.is(metrics.feePoolBalance.value, 0n, 'feePool empty');
t.is(metrics.mintedPoolBalance.value, 500_000n, 'mintedPool +500K');
t.is(metrics.totalAnchorProvided.value, 0n, 'totalAnchor empty');
t.is(metrics.totalMintedProvided.value, 500_000n, 'totalMinted +500K');
});
Loading
Loading