Skip to content

Commit

Permalink
test: PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
iomekam committed Sep 7, 2023
1 parent 1db5987 commit bf79c61
Show file tree
Hide file tree
Showing 25 changed files with 164 additions and 251 deletions.
37 changes: 36 additions & 1 deletion packages/deployment/upgrade-test/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@ ENV THIS_NAME=agoric-upgrade-10 USE_JS=1 BOOTSTRAP_MODE=${BOOTSTRAP_MODE}

WORKDIR /usr/src/agoric-sdk/
COPY ./bash_entrypoint.sh ./env_setup.sh ./start_to_to.sh ./package.json ./*.mjs ./upgrade-test-scripts/

WORKDIR /usr/src/agoric-sdk/upgrade-test-scripts
RUN yarn
RUN echo '. /usr/src/agoric-sdk/upgrade-test-scripts/env_setup.sh' >> ~/.bashrc

WORKDIR /usr/src/agoric-sdk/

COPY ./${THIS_NAME} ./upgrade-test-scripts/${THIS_NAME}/
COPY --from=agoric-upgrade-9 /root/.agoric /root/.agoric
RUN chmod +x ./upgrade-test-scripts/*.sh
Expand All @@ -96,9 +103,16 @@ FROM ghcr.io/agoric/agoric-sdk:35 as propose-agoric-upgrade-11
# This default UPGRADE_INFO_11 is to test core proposals like the network vat.
# TODO: Maybe replace with a Zoe core proposal, or remove when other paths test it.
ARG BOOTSTRAP_MODE UPGRADE_INFO_11='{"coreProposals":["@agoric/builders/scripts/vats/init-network.js"]}'
ENV THIS_NAME=propose-agoric-upgrade-11 UPGRADE_TO=agoric-upgrade-11 UPGRADE_INFO=${UPGRADE_INFO_11} BOOTSTRAP_MODE=${BOOTSTRAP_MODE}
ENV THIS_NAME=propose-agoric-upgrade-11 UPGRADE_TO=agoric-upgrade-11 BOOTSTRAP_MODE=${BOOTSTRAP_MODE}
WORKDIR /usr/src/agoric-sdk/
COPY ./bash_entrypoint.sh ./env_setup.sh ./start_to_to.sh ./upgrade-test-scripts/

WORKDIR /usr/src/agoric-sdk/upgrade-test-scripts
RUN yarn
RUN echo '. /usr/src/agoric-sdk/upgrade-test-scripts/env_setup.sh' >> ~/.bashrc

WORKDIR /usr/src/agoric-sdk/

COPY ./${THIS_NAME} ./upgrade-test-scripts/${THIS_NAME}/
COPY --from=agoric-upgrade-10 /root/.agoric /root/.agoric
RUN chmod +x ./upgrade-test-scripts/*.sh
Expand All @@ -114,6 +128,13 @@ ENV THIS_NAME=agoric-upgrade-11 BOOTSTRAP_MODE=${BOOTSTRAP_MODE} USE_JS=1
# start-chain boilerplate
WORKDIR /usr/src/agoric-sdk/
COPY ./bash_entrypoint.sh ./env_setup.sh ./start_to_to.sh ./package.json ./*.mjs ./upgrade-test-scripts/

WORKDIR /usr/src/agoric-sdk/upgrade-test-scripts
RUN yarn
RUN echo '. /usr/src/agoric-sdk/upgrade-test-scripts/env_setup.sh' >> ~/.bashrc

WORKDIR /usr/src/agoric-sdk/

COPY ./${THIS_NAME} ./upgrade-test-scripts/${THIS_NAME}/
COPY --from=propose-agoric-upgrade-11 /root/.agoric /root/.agoric
RUN chmod +x ./upgrade-test-scripts/*.sh
Expand All @@ -130,6 +151,13 @@ COPY --from=agoric-upgrade-11 /root/.agoric /root/.agoric
# start-chain boilerplate
WORKDIR /usr/src/agoric-sdk/
COPY ./bash_entrypoint.sh ./env_setup.sh ./start_to_to.sh ./upgrade-test-scripts/

WORKDIR /usr/src/agoric-sdk/upgrade-test-scripts
RUN yarn
RUN echo '. /usr/src/agoric-sdk/upgrade-test-scripts/env_setup.sh' >> ~/.bashrc

WORKDIR /usr/src/agoric-sdk/

COPY ./${THIS_NAME} ./upgrade-test-scripts/${THIS_NAME}/
RUN chmod +x ./upgrade-test-scripts/*.sh
SHELL ["/bin/bash", "-c"]
Expand All @@ -145,6 +173,13 @@ COPY --from=propose-agoric-upgrade-12 /root/.agoric /root/.agoric
# start-chain boilerplate
WORKDIR /usr/src/agoric-sdk/
COPY ./bash_entrypoint.sh ./env_setup.sh ./start_to_to.sh ./package.json ./*.mjs ./upgrade-test-scripts/

WORKDIR /usr/src/agoric-sdk/upgrade-test-scripts
RUN yarn
RUN echo '. /usr/src/agoric-sdk/upgrade-test-scripts/env_setup.sh' >> ~/.bashrc

WORKDIR /usr/src/agoric-sdk/

COPY ./${THIS_NAME} ./upgrade-test-scripts/${THIS_NAME}/
RUN apt install -y tmux
SHELL ["/bin/bash", "-c"]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,20 @@
import { promises as fs } from 'fs';
import assert from 'assert';

import {
waitForBlock,
provisionSmartWallet,
getUser,
executeOffer,
} from './upgradeHelpers.mjs';
import {
agd,
agoric,
agops,
agopsLocation,
executeCommand,
} from '../cliHelper.mjs';
} from '../cliHelper.js';
import {
HOME,
ATOM_DENOM,
GOV1ADDR,
GOV2ADDR,
GOV3ADDR,
} from '../constants.mjs';
} from '../constants.js';

const govAccounts = [GOV1ADDR, GOV2ADDR, GOV3ADDR];

Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
import test from 'ava';

import {
waitForBlock,
submitDeliverInbound,
getUser,
newOfferId,
openVault,
adjustVault,
closeVault,
} from './upgradeHelpers.mjs';
import {
provisionWallet,
implementNewAuctionParams,
raiseDebtCeiling,
pushPrice,
} from './actions.mjs';
import { agd, agoric, agops } from '../cliHelper.mjs';
import { GOV1ADDR, GOV2ADDR } from '../constants.mjs';
} from './actions.js';
import { agd, agoric, agops } from '../cliHelper.js';
import { GOV1ADDR, GOV2ADDR } from '../constants.js';
import { getUser, newOfferId, waitForBlock } from '../coreUpgradeHelpers.js';
import { submitDeliverInbound } from './upgradeHelpers.js';

const START_FREQUENCY = 600; // StartFrequency: 600s (auction runs every 10m)
const CLOCK_STEP = 20; // ClockStep: 20s (ensures auction completes in time)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import test from 'ava';

import { agd, agoric } from '../cliHelper.mjs';
import { GOV1ADDR, GOV2ADDR, GOV3ADDR, USER1ADDR } from '../constants.mjs';
import { calculateWalletState } from './upgradeHelpers.mjs';
import { agd, agoric } from '../cliHelper.js';
import { GOV1ADDR, GOV2ADDR, GOV3ADDR, USER1ADDR } from '../constants.js';
import { calculateWalletState } from './upgradeHelpers.js';

test('DeliverInbound from un-provisioned account is discarded', async t => {
const result = await agd.query('swingset', 'mailbox', USER1ADDR);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@ import test from 'ava';

import { promises as fs } from 'fs';

import { waitForBlock, getUser, openVault } from './upgradeHelpers.mjs';
import { agd, agoric, agops } from '../cliHelper.mjs';
import { agd, agoric, agops } from '../cliHelper.js';

import {
GOV1ADDR,
GOV2ADDR,
GOV3ADDR,
BOOTSTRAP_MODE,
PSM_PAIR,
} from '../constants.mjs';
} from '../constants.js';
import { openVault } from '../econHelpers.js';
import { getUser, waitForBlock } from '../coreUpgradeHelpers.js';

test.before(async () => {
console.log('Wait for upgrade to settle');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@ import {
VALIDATORADDR,
USER1ADDR,
CHAINID,
} from '../constants.mjs';
} from '../constants.js';

import { agd } from '../cliHelper.mjs';

export * from '../coreUpgradeHelpers.mjs';
import { agd } from '../cliHelper.js';
import { getUser } from '../coreUpgradeHelpers.js';

export const printKeys = async () => {
console.log('========== GOVERNANCE KEYS ==========');
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import test from 'ava';

import { adjustVault, closeVault, openVault } from './upgradeHelpers.mjs';
import { agoric, agops } from '../cliHelper.mjs';
import { GOV1ADDR } from '../constants.mjs';
import { agoric, agops } from '../cliHelper.js';
import { GOV1ADDR } from '../constants.js';
import { openVault, adjustVault, closeVault } from '../econHelpers.js';

test.serial('Open Vaults', async t => {
const currentVaults = await agops.vaults('list', '--from', GOV1ADDR);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from 'ava';

test(`Replace me`, async t => {
t.pass()
test(`Replace me`, t => {
t.pass();
});
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import test from 'ava';

import { waitForBlock } from './upgradeHelpers.mjs';
import { agd, agoric } from '../cliHelper.mjs';
import { agd, agoric } from '../cliHelper.js';

test.before(async () => {
console.log('Wait for upgrade to settle');
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { promises as fs } from 'fs';
import * as path from 'path';
import { dirname as dname } from 'path';
import { dirname } from 'path';
import { fileURLToPath } from 'url';
import { voteLatestProposalAndWait } from '../coreUpgradeHelpers.mjs';
import { CHAINID, GOV1ADDR, VALIDATORADDR } from '../constants.mjs';
import { agd, bundleSource } from '../cliHelper.mjs';
import { voteLatestProposalAndWait } from '../coreUpgradeHelpers.js';
import { CHAINID, GOV1ADDR, VALIDATORADDR } from '../constants.js';
import { agd, bundleSource } from '../cliHelper.js';

const dirname = dname(fileURLToPath(import.meta.url));
const directoryName = dirname(fileURLToPath(import.meta.url));

export const installBundles = async bundlesData => {
const bundleIds = {};
Expand Down Expand Up @@ -59,12 +59,12 @@ export const prepForCoreEval = async (filePath, constants) => {

export const runProber = async bundleId => {
const proberScriptPath = path.join(
dirname,
directoryName,
'zoe-full-upgrade',
'run-prober-script.js',
);
const proberUpgradePermitPath = path.join(
dirname,
directoryName,
'zoe-full-upgrade',
'zcf-upgrade-permit.json',
);
Expand Down Expand Up @@ -96,12 +96,12 @@ export const runProber = async bundleId => {

export const runZcfUpgrade = async (zcfBundleId, zoeBundleId) => {
const zcfScriptPath = path.join(
dirname,
directoryName,
'zoe-full-upgrade',
'zcf-upgrade-script.js',
);
const zcfUpgradePermitPath = path.join(
dirname,
directoryName,
'zoe-full-upgrade',
'zcf-upgrade-permit.json',
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
import test from 'ava';

import {
adjustVault,
closeVault,
installBundle,
mintIST,
openVault,
proposalBuilder,
submitProposal,
voteLatestProposalAndWait,
} from '../coreUpgradeHelpers.mjs';
import { agd, agoric, agops } from '../cliHelper.mjs';
import { GOV1ADDR, SDK_ROOT } from '../constants.mjs';
import { installBundles, runZcfUpgrade, runProber } from './actions.mjs';
import { agd, agoric, agops } from '../cliHelper.js';
import { GOV1ADDR, SDK_ROOT } from '../constants.js';
import { installBundles, runZcfUpgrade, runProber } from './actions.js';
import { adjustVault, closeVault, mintIST, openVault } from '../econHelpers.js';

test.before(async t => {
await mintIST(GOV1ADDR, 1234000000, 10000, 2000);
await mintIST(GOV1ADDR, 12340000000, 10000, 2000);

const bundlesData = [
{
Expand Down Expand Up @@ -81,32 +72,3 @@ test.serial('Run Prober (second time)', async t => {
const value = JSON.parse(data.value);
t.is(value.values[0], 'true');
});

test.serial('Upgrade wallet factory and start game', async t => {
const upgradeFilePaths = [
`${SDK_ROOT}/packages/builders/scripts/smart-wallet/build-walletFactory-upgrade.js`,
`${SDK_ROOT}/packages/builders/scripts/smart-wallet/build-game1-start.js`,
];

for (const filePath of upgradeFilePaths) {
const { evals, bundles } = await proposalBuilder(filePath);

console.log('Installing bundle');
for (const bundleId of bundles) {
await installBundle(GOV1ADDR, bundleId);
}

for (const entry of evals) {
await submitProposal(
entry.script,
entry.permit,
'Add NFT/non-vbank support in WalletFactory',
'Upgrade WalletFactory to support arbitrary ERTP assets such as NFTs',
);

await voteLatestProposalAndWait();
}
}

t.pass();
});

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import test from 'ava';
import { main } from './tools/vat-status.mjs';
import { getIncarnation } from './tools/vat-status.js';

test(`Verify Zoe vat incarnatin`, async t => {
const incarantion = await main('zoe');
const incarantion = await getIncarnation('zoe');
t.is(incarantion, 1);
});
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import test from 'ava';

import { waitForBlock } from '../coreUpgradeHelpers.mjs';
import { main } from './tools/vat-status.mjs';
import { waitForBlock } from '../coreUpgradeHelpers.js';
import { getIncarnation } from './tools/vat-status.js';

test.before(async () => {
console.log('Wait for upgrade to settle');
Expand All @@ -10,6 +10,6 @@ test.before(async () => {
});

test(`Ensure Zoe Vat is at 0`, async t => {
const incarnation = await main("zoe")
t.is(incarnation, 0)
const incarnation = await getIncarnation('zoe');
t.is(incarnation, 0);
});

This file was deleted.

Loading

0 comments on commit bf79c61

Please sign in to comment.