Skip to content

Commit

Permalink
chore: cleanup suggestions post-submission of 9970
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris-Hibbert committed Aug 27, 2024
1 parent 43345a5 commit fc55ef5
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 31 deletions.
4 changes: 2 additions & 2 deletions a3p-integration/proposals/a:vaults-auctions/agd-tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,15 +202,15 @@ export const getProvisionPoolMetrics = async () => {
return getQuoteBody(path);
};

export const getAuctionInstance = async price => {
export const getInstanceBoardId = async instanceName => {
const instanceRec = await queryVstorage(`published.agoricNames.instance`);

const value = JSON.parse(instanceRec.value);
const body = JSON.parse(value.values.at(-1));

const feeds = JSON.parse(body.body.substring(1));

const key = Object.keys(feeds).find(k => feeds[k][0] === 'auctioneer');
const key = Object.keys(feeds).find(k => feeds[k][0] === instanceName);
if (key) {
return body.slots[key];
}
Expand Down
5 changes: 1 addition & 4 deletions a3p-integration/proposals/a:vaults-auctions/eval.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
# we have an eval.sh so we can run prepare.sh before the rest

echo "[$PROPOSAL] Running prepare.sh"
./prepare.sh
./saveAuctionInstance.js

echo "[$PROPOSAL] Running proposal declared in package.json"
# copy to run in the proposal package so the dependencies can be resolved
Expand Down
8 changes: 0 additions & 8 deletions a3p-integration/proposals/a:vaults-auctions/prepare.sh

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
#!/usr/bin/env node

import { writeFile } from 'fs/promises';
import { getAuctionInstance } from './agd-tools.js';
import { getInstanceBoardId } from './agd-tools.js';

const { env } = process;

const oldAuctionInstance = await getAuctionInstance();
const oldAuctionInstance = await getInstanceBoardId('auctioneer');
console.log('old auction instance ', oldAuctionInstance, env.HOME);

await writeFile(
`${env.HOME}/.agoric/previousInstance.json`,
oldAuctionInstance,
);
const filePath = `${env.HOME}/.agoric/tmp/auctionPreviousInstance.json`;

await writeFile(filePath, oldAuctionInstance);
18 changes: 7 additions & 11 deletions a3p-integration/proposals/a:vaults-auctions/upgradeVaults.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
openVault,
USER1ADDR,
} from '@agoric/synthetic-chain';
import { readFile } from 'fs/promises';
import { readFile, unlink } from 'fs/promises';

import {
bankSend,
Expand All @@ -17,7 +17,7 @@ import {
getVaultPrices,
pushPrices,
addPreexistingOracles,
getAuctionInstance,
getInstanceBoardId,
} from './agd-tools.js';
import { getDetailsMatchingVats } from './vatDetails.js';

Expand Down Expand Up @@ -108,19 +108,15 @@ const verifyVaultPriceUpdate = async t => {
};

const verifyAuctionInstance = async t => {
const newAuctionInstance = await getAuctionInstance();
const oldInstance = await readFile(
`${env.HOME}/.agoric/previousInstance.json`,
'utf-8',
);
const newAuctionInstance = await getInstanceBoardId('auctioneer');
const filePath = `${env.HOME}/.agoric/tmp/auctionPreviousInstance.json`;
const oldInstance = await readFile(filePath, 'utf-8');

console.log(
`new: ${newAuctionInstance} should be different from ${oldInstance}`,
);
t.true(
newAuctionInstance !== oldInstance,
`new: ${newAuctionInstance} should be different from ${oldInstance}`,
);
t.not(newAuctionInstance, oldInstance);
await unlink();
};

// test.serial() isn't guaranteed to run tests in order, so we run the intended tests here
Expand Down

0 comments on commit fc55ef5

Please sign in to comment.