Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Agoric/agoric-sdk into io…
Browse files Browse the repository at this point in the history
…mekam-ar-upgrade-tests
  • Loading branch information
iomekam committed Dec 16, 2024
2 parents b17f601 + 3e27c74 commit a62afad
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 5 deletions.
54 changes: 54 additions & 0 deletions packages/builders/scripts/testing/provokeBOYD.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/**
* @file call getTimerBrand() 300 times in hopes of provoking BOYD. This is
* intended for tests on mainFork for upgrade-18. If there's a similar need in
* other tests, it can be included there as well. There would be no value in
* including it in an upgrade of MainNet; it just spins cycles to provoke
* garbage collection.
*/

import { makeTracer } from '@agoric/internal';
import { E } from '@endo/far';

/// <reference types="@agoric/vats/src/core/types-ambient"/>
/** @import {Instance} from '@agoric/zoe/src/zoeService/utils.js'; */

const trace = makeTracer('provokeBOYD', true);

/**
* @param {BootstrapPowers} powers
*/
export const provokeBOYD = async ({ consume: { chainTimerService } }) => {
trace(provokeBOYD.name);
await null;

for (let i = 0; i < 300; i += 1) {
await E(chainTimerService).getTimerBrand();
}
trace('done');
};
harden(provokeBOYD);

export const getManifestForProvokeBOYD = () => {
return {
manifest: {
[provokeBOYD.name]: {
consume: { chainTimerService: true },
},
},
};
};

/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
export const defaultProposalBuilder = async () =>
harden({
sourceSpec: '@agoric/builders/scripts/testing/provokeBOYD.js',
getManifestCall: ['getManifestForProvokeBOYD'],
});

/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').DeployScriptFunction} */
export default async (homeP, endowments) => {
const dspModule = await import('@agoric/deploy-script-support');
const { makeHelpers } = dspModule;
const { writeCoreEval } = await makeHelpers(homeP, endowments);
await writeCoreEval(provokeBOYD.name, defaultProposalBuilder);
};
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const trace = makeTracer('RecordedRetired', true);
export const testRecordedRetiredInstances = async ({
consume: {
contractKits,
// governedContractKits,
governedContractKits,
retiredContractInstances: retiredContractInstancesP,
},
}) => {
Expand All @@ -26,8 +26,7 @@ export const testRecordedRetiredInstances = async ({
assert(auctionIDs.length === 1);
const auctionInstance = retiredContractInstances.get(auctionIDs[0]);
trace({ auctionInstance });
// I don't know why it's neither in governedContractKits nor contractKits
// assert(await E(governedContractKits).get(auctionInstance));
assert(await E(governedContractKits).get(auctionInstance));

const committeeIDs = Array.from(retiredContractInstances.keys()).filter(k =>
k.startsWith('economicCommittee'),
Expand All @@ -47,7 +46,7 @@ export const getManifestForRecordedRetiredInstances = () => {
[testRecordedRetiredInstances.name]: {
consume: {
contractKits: true,
// governedContractKits: true,
governedContractKits: true,
retiredContractInstances: true,
},
},
Expand Down
15 changes: 14 additions & 1 deletion packages/inter-protocol/src/proposals/add-auction.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,20 @@ export const addAuction = async (
produceRetiredInstances,
);

const governedContractKits = await governedContractKitsP;
trace('has', governedContractKits.has(legacyKit.instance));
if (governedContractKits.has(legacyKit.instance)) {
// bootstrap tests start having already run this upgrade. Actual upgrades on
// mainNet or testnets should start with the promiseSpace post upgrade-17,
// which doesn't have this entry in the map.
trace(
'⚠️ WARNING: not expected during chain upgrade. It IS normal during bootstrap tests',
);
} else {
// @ts-expect-error The original auctioneerKit had everything it needs
governedContractKits.init(legacyKit.instance, legacyKit);
}

// save the auctioneer instance so we can manage it later
const boardID = await E(board).getId(legacyKit.instance);
const identifier = `auctioneer-${boardID}`;
Expand Down Expand Up @@ -205,7 +219,6 @@ export const addAuction = async (
governedInstance,
);

const governedContractKits = await governedContractKitsP;
governedContractKits.init(kit.instance, kit);
auctionUpgradeNewInstance.resolve(governedInstance);
auctionUpgradeNewGovCreator.resolve(kit.governorCreatorFacet);
Expand Down

0 comments on commit a62afad

Please sign in to comment.