Skip to content

Commit

Permalink
test: add proposal w/300 E(chainTimerService).getTimerBrand() calls
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris-Hibbert committed Dec 16, 2024
1 parent 140c1be commit b3b7666
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions packages/builders/scripts/testing/provokeBOYD.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/**
* @file call getTimerBrand() 300 times in hopes of provoking BOYD.
*/
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);
};

0 comments on commit b3b7666

Please sign in to comment.