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

test: add proposal w/300 E(chainTimerService).getTimerBrand() calls #10696

Merged
merged 2 commits into from
Dec 16, 2024
Merged
Changes from all 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
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);
};
Loading