From 22cda0c208d864ae8fa7f106dfff6fd2226a7565 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Tue, 8 Feb 2022 16:52:35 -0800 Subject: [PATCH] test: update zoe+swingset-using tests to provide zcfBundle This updates unit tests in (zoe, governance, run-protocol), specifically those which use a swingset environment, to fetch the ZCF contract bundle from the Zoe package, and install it into the kernel config they build. This is necessary now that Zoe's `setupCreateZCFVat` no longer includes a copy. Any new tests which follow this pattern will need to do the same. refs #4487 --- .../test/swingsetTests/committeeBinary/test-committee.js | 2 ++ .../test/swingsetTests/contractGovernor/test-governor.js | 2 ++ .../vaultFactory/swingsetTests/governance/test-governance.js | 2 ++ .../swingsetTests/vaultFactory/test-vaultFactory.js | 2 ++ .../swingsetTests/brokenContracts/test-crashingContract.js | 3 ++- packages/zoe/test/swingsetTests/makeKind/test-makeKind.js | 2 ++ packages/zoe/test/swingsetTests/offerArgs/test-offerArgs.js | 2 ++ .../zoe/test/swingsetTests/privateArgs/test-privateArgs.js | 2 ++ packages/zoe/test/swingsetTests/runMint/test-runMint.js | 2 ++ packages/zoe/test/swingsetTests/zoe/test-zoe.js | 4 +++- 10 files changed, 21 insertions(+), 2 deletions(-) diff --git a/packages/governance/test/swingsetTests/committeeBinary/test-committee.js b/packages/governance/test/swingsetTests/committeeBinary/test-committee.js index e723d37fd27..9d683e29a94 100644 --- a/packages/governance/test/swingsetTests/committeeBinary/test-committee.js +++ b/packages/governance/test/swingsetTests/committeeBinary/test-committee.js @@ -10,6 +10,7 @@ import '@endo/init'; import test from 'ava'; import { buildVatController, buildKernelBundles } from '@agoric/swingset-vat'; import bundleSource from '@endo/bundle-source'; +import zcfBundle from '@agoric/zoe/bundles/bundle-contractFacet.js'; import path from 'path'; const CONTRACT_FILES = ['committee', 'binaryVoteCounter']; @@ -47,6 +48,7 @@ test.before(async t => { parameters: { contractBundles }, // argv will be added to this }; const config = { bootstrap: 'bootstrap', vats }; + config.bundles = { zcf: { bundle: zcfBundle } }; config.defaultManagerType = 'xs-worker'; const step4 = Date.now(); diff --git a/packages/governance/test/swingsetTests/contractGovernor/test-governor.js b/packages/governance/test/swingsetTests/contractGovernor/test-governor.js index 12190ee965a..bfaccb38a7a 100644 --- a/packages/governance/test/swingsetTests/contractGovernor/test-governor.js +++ b/packages/governance/test/swingsetTests/contractGovernor/test-governor.js @@ -12,6 +12,7 @@ import path from 'path'; import { buildVatController, buildKernelBundles } from '@agoric/swingset-vat'; import bundleSource from '@endo/bundle-source'; +import zcfBundle from '@agoric/zoe/bundles/bundle-contractFacet.js'; const CONTRACT_FILES = [ 'committee', @@ -62,6 +63,7 @@ test.before(async t => { parameters: { contractBundles }, // argv will be added to this }; const config = { bootstrap: 'bootstrap', vats }; + config.bundles = { zcf: { bundle: zcfBundle } }; config.defaultManagerType = 'xs-worker'; const step4 = Date.now(); diff --git a/packages/run-protocol/test/vaultFactory/swingsetTests/governance/test-governance.js b/packages/run-protocol/test/vaultFactory/swingsetTests/governance/test-governance.js index d566558efc5..0199c2728de 100644 --- a/packages/run-protocol/test/vaultFactory/swingsetTests/governance/test-governance.js +++ b/packages/run-protocol/test/vaultFactory/swingsetTests/governance/test-governance.js @@ -11,6 +11,7 @@ import { buildVatController, buildKernelBundles } from '@agoric/swingset-vat'; import bundleSource from '@endo/bundle-source'; import { E } from '@agoric/eventual-send'; import path from 'path'; +import zcfBundle from '@agoric/zoe/bundles/bundle-contractFacet.js'; import { governanceBundles, economyBundles, @@ -53,6 +54,7 @@ test.before(async t => { vats.bootstrap.parameters = { contractBundles }; const config = { bootstrap: 'bootstrap', vats }; + config.bundles = { zcf: { bundle: zcfBundle } }; config.defaultManagerType = 'xs-worker'; t.context.data = { kernelBundles, config }; diff --git a/packages/run-protocol/test/vaultFactory/swingsetTests/vaultFactory/test-vaultFactory.js b/packages/run-protocol/test/vaultFactory/swingsetTests/vaultFactory/test-vaultFactory.js index 7bcbfb706f3..7d59c3dd8e4 100644 --- a/packages/run-protocol/test/vaultFactory/swingsetTests/vaultFactory/test-vaultFactory.js +++ b/packages/run-protocol/test/vaultFactory/swingsetTests/vaultFactory/test-vaultFactory.js @@ -11,6 +11,7 @@ import path from 'path'; import { buildVatController, buildKernelBundles } from '@agoric/swingset-vat'; import bundleSource from '@endo/bundle-source'; import { E } from '@agoric/eventual-send'; +import zcfBundle from '@agoric/zoe/bundles/bundle-contractFacet.js'; import liquidateMinimumBundle from '../../../../bundles/bundle-liquidateMinimum.js'; import ammBundle from '../../../../bundles/bundle-amm.js'; @@ -51,6 +52,7 @@ export const buildSwingSetConfig = async (contractBundles, vatNames) => { vats.bootstrap.parameters = { contractBundles }; const config = { bootstrap: 'bootstrap', vats }; + config.bundles = { zcf: { bundle: zcfBundle } }; config.defaultManagerType = 'xs-worker'; return config; }; diff --git a/packages/zoe/test/swingsetTests/brokenContracts/test-crashingContract.js b/packages/zoe/test/swingsetTests/brokenContracts/test-crashingContract.js index 1d5ba0394df..2d458949f98 100644 --- a/packages/zoe/test/swingsetTests/brokenContracts/test-crashingContract.js +++ b/packages/zoe/test/swingsetTests/brokenContracts/test-crashingContract.js @@ -11,8 +11,8 @@ import path from 'path'; import { loadBasedir, buildVatController } from '@agoric/swingset-vat'; import bundleSource from '@endo/bundle-source'; - import fs from 'fs'; +import zcfBundle from '../../../bundles/bundle-contractFacet.js'; const filename = new URL(import.meta.url).pathname; const dirname = path.dirname(filename); @@ -32,6 +32,7 @@ const generateBundlesP = Promise.all( async function main(argv) { const config = await loadBasedir(dirname); config.defaultManagerType = 'xs-worker'; + config.bundles = { zcf: { bundle: zcfBundle } }; await generateBundlesP; const controller = await buildVatController(config, argv); await controller.run(); diff --git a/packages/zoe/test/swingsetTests/makeKind/test-makeKind.js b/packages/zoe/test/swingsetTests/makeKind/test-makeKind.js index 95b31c1342c..ad12da918f8 100644 --- a/packages/zoe/test/swingsetTests/makeKind/test-makeKind.js +++ b/packages/zoe/test/swingsetTests/makeKind/test-makeKind.js @@ -9,6 +9,7 @@ import path from 'path'; // eslint-disable-next-line import/no-extraneous-dependencies import { buildVatController, buildKernelBundles } from '@agoric/swingset-vat'; import bundleSource from '@endo/bundle-source'; +import zcfBundle from '../../../bundles/bundle-contractFacet.js'; const CONTRACT_FILES = ['minimalMakeKindContract']; @@ -51,6 +52,7 @@ test.before(async t => { parameters: { contractBundles }, // argv will be added to this }; const config = { bootstrap: 'bootstrap', vats }; + config.bundles = { zcf: { bundle: zcfBundle } }; config.defaultManagerType = 'xs-worker'; const step4 = Date.now(); diff --git a/packages/zoe/test/swingsetTests/offerArgs/test-offerArgs.js b/packages/zoe/test/swingsetTests/offerArgs/test-offerArgs.js index 6ff7e0ad392..3841a8b9892 100644 --- a/packages/zoe/test/swingsetTests/offerArgs/test-offerArgs.js +++ b/packages/zoe/test/swingsetTests/offerArgs/test-offerArgs.js @@ -9,6 +9,7 @@ import path from 'path'; // eslint-disable-next-line import/no-extraneous-dependencies import { buildVatController, buildKernelBundles } from '@agoric/swingset-vat'; import bundleSource from '@endo/bundle-source'; +import zcfBundle from '../../../bundles/bundle-contractFacet.js'; const CONTRACT_FILES = ['offerArgsUsageContract']; @@ -51,6 +52,7 @@ test.before(async t => { parameters: { contractBundles }, // argv will be added to this }; const config = { bootstrap: 'bootstrap', vats }; + config.bundles = { zcf: { bundle: zcfBundle } }; config.defaultManagerType = 'xs-worker'; const step4 = Date.now(); diff --git a/packages/zoe/test/swingsetTests/privateArgs/test-privateArgs.js b/packages/zoe/test/swingsetTests/privateArgs/test-privateArgs.js index c46d1aa928d..27821242f5c 100644 --- a/packages/zoe/test/swingsetTests/privateArgs/test-privateArgs.js +++ b/packages/zoe/test/swingsetTests/privateArgs/test-privateArgs.js @@ -9,6 +9,7 @@ import path from 'path'; // eslint-disable-next-line import/no-extraneous-dependencies import { buildVatController, buildKernelBundles } from '@agoric/swingset-vat'; import bundleSource from '@endo/bundle-source'; +import zcfBundle from '../../../bundles/bundle-contractFacet.js'; const CONTRACT_FILES = ['privateArgsUsageContract']; @@ -51,6 +52,7 @@ test.before(async t => { parameters: { contractBundles }, // argv will be added to this }; const config = { bootstrap: 'bootstrap', vats }; + config.bundles = { zcf: { bundle: zcfBundle } }; config.defaultManagerType = 'xs-worker'; const step4 = Date.now(); diff --git a/packages/zoe/test/swingsetTests/runMint/test-runMint.js b/packages/zoe/test/swingsetTests/runMint/test-runMint.js index 7b9a70cbf20..cbffb549be9 100644 --- a/packages/zoe/test/swingsetTests/runMint/test-runMint.js +++ b/packages/zoe/test/swingsetTests/runMint/test-runMint.js @@ -9,6 +9,7 @@ import path from 'path'; // eslint-disable-next-line import/no-extraneous-dependencies import { buildVatController, buildKernelBundles } from '@agoric/swingset-vat'; import bundleSource from '@endo/bundle-source'; +import zcfBundle from '../../../bundles/bundle-contractFacet.js'; // offerArgsUsageContract is just used as a generic contract for the // purpose of registering a feeBrand before any zcfMint for the @@ -54,6 +55,7 @@ test.before(async t => { parameters: { contractBundles }, // argv will be added to this }; const config = { bootstrap: 'bootstrap', vats }; + config.bundles = { zcf: { bundle: zcfBundle } }; config.defaultManagerType = 'xs-worker'; const step4 = Date.now(); diff --git a/packages/zoe/test/swingsetTests/zoe/test-zoe.js b/packages/zoe/test/swingsetTests/zoe/test-zoe.js index c57c44383a2..6d102f8bbc4 100644 --- a/packages/zoe/test/swingsetTests/zoe/test-zoe.js +++ b/packages/zoe/test/swingsetTests/zoe/test-zoe.js @@ -10,6 +10,7 @@ import test from 'ava'; import path from 'path'; import { buildVatController, buildKernelBundles } from '@agoric/swingset-vat'; import bundleSource from '@endo/bundle-source'; +import zcfBundle from '../../../bundles/bundle-contractFacet.js'; const filename = new URL(import.meta.url).pathname; const dirname = path.dirname(filename); @@ -49,6 +50,7 @@ test.before(async t => { contractBundles[bundleName] = bundle; }), ); + const bundles = { zcf: { bundle: zcfBundle } }; const step3 = Date.now(); const vats = {}; @@ -64,7 +66,7 @@ test.before(async t => { bundle: await bundleSource(bootstrapSource), parameters: { contractBundles }, // argv will be added to this }; - const config = { bootstrap: 'bootstrap', vats }; + const config = { bootstrap: 'bootstrap', vats, bundles }; config.defaultManagerType = 'xs-worker'; const step4 = Date.now();