diff --git a/contract/Makefile b/contract/Makefile index 3bd65b81..04a9e6a1 100644 --- a/contract/Makefile +++ b/contract/Makefile @@ -22,10 +22,10 @@ SIGN_BROADCAST_OPTS=--keyring-backend=test --chain-id=$(CHAINID) \ --yes -b block mint100: - make FUNDS=1000$(ATOM) fund-acct - cd /usr/src/agoric-sdk && \ - yarn --silent agops vaults open --wantMinted 100 --giveCollateral 100 >/tmp/want-ist.json && \ - yarn --silent agops perf satisfaction --executeOffer /tmp/want-ist.json --from user1 --keyring-backend=test + # make FUNDS=1000$(ATOM) fund-acct + # cd /usr/src/agoric-sdk && \ + # yarn --silent agops vaults open --wantMinted 100 --giveCollateral 100 >/tmp/want-ist.json && \ + # yarn --silent agops perf satisfaction --executeOffer /tmp/want-ist.json --from user1 --keyring-backend=test # Keep mint4k around a while for compatibility mint4k: diff --git a/contract/package.json b/contract/package.json index fe6392cf..3cb738bc 100644 --- a/contract/package.json +++ b/contract/package.json @@ -7,10 +7,13 @@ "scripts": { "start:docker": "docker compose up -d", "docker:logs": "docker compose logs --tail 200 -f", - "docker:bash": "docker compose exec agd bash", - "docker:make": "docker compose exec agd make -C /workspace/contract", + "docker:bash": "docker exec agd bash", + "docker:make": "docker exec agd make -C /ws-agoric-basics/contract", "make:help": "make list", - "start": "make clean start-contract", + "docker:copy-Makefile": "docker exec agd mkdir -p /ws-agoric-basics/contract; docker cp Makefile agd:/ws-agoric-basics/contract/", + "docker:copy-scripts": "docker cp scripts agd:/ws-agoric-basics/contract/", + "docker:copy-tools": "docker cp tools agd:/ws-agoric-basics/contract/", + "start": "yarn docker:copy-Makefile; yarn docker:copy-scripts; yarn docker:copy-tools; make clean start-contract", "build": "yarn build:deployer", "build:deployer": "rollup -c rollup.config.mjs", "test": "ava --verbose", diff --git a/contract/scripts/deploy-contract.js b/contract/scripts/deploy-contract.js index 6e7e62e4..f5c45a5a 100755 --- a/contract/scripts/deploy-contract.js +++ b/contract/scripts/deploy-contract.js @@ -16,7 +16,7 @@ const options = { install: { type: 'string' }, eval: { type: 'string', multiple: true }, service: { type: 'string', default: 'agd' }, - workdir: { type: 'string', default: '/workspace/contract' }, + workdir: { type: 'string', default: '/ws-agoric-basics/contract' }, }; /** * @typedef {{ @@ -74,9 +74,9 @@ const main = async (bundleDir = 'bundles') => { /** @type {import('../tools/agd-lib.js').ExecSync} */ const dockerExec = (file, dargs, opts = { encoding: 'utf-8' }) => { - const execArgs = ['compose', 'exec', '--workdir', workdir, service]; + const execArgs = [ 'exec', '--workdir', workdir, service]; opts.verbose && - console.log('docker compose exec', JSON.stringify([file, ...dargs])); + console.log('docker exec', JSON.stringify([file, ...dargs])); return execFileSync('docker', [...execArgs, file, ...dargs], opts); }; diff --git a/contract/scripts/run-chain.sh b/contract/scripts/run-chain.sh index e6435bd4..acf5545c 100755 --- a/contract/scripts/run-chain.sh +++ b/contract/scripts/run-chain.sh @@ -41,11 +41,11 @@ waitForBlock() ( approveProposals() { while true; do - proposals=$(make -s -C /workspace/contract gov-voting-q 2>/dev/null) + proposals=$(make -s -C /ws-agoric-basics/contract gov-voting-q 2>/dev/null) exit_status=$? if [ $exit_status -eq 0 ]; then echo "Approving proposals: $proposals" - printf $proposals | xargs -I {} make -s -C /workspace/contract vote PROPOSAL={} + printf $proposals | xargs -I {} make -s -C /ws-agoric-basics/contract vote PROPOSAL={} else echo "No proposals to approve, continuing..." fi @@ -63,7 +63,7 @@ waitForBlock 2 # Approve any proposals forever in the background. approveProposals & -make -C /workspace/contract mint100 +# make -C /ws-agoric-basics/contract mint100 # bring back chain process to foreground wait diff --git a/contract/test/test-postalSvc.js b/contract/test/test-postalSvc.js index 922cf23c..bacd0da5 100644 --- a/contract/test/test-postalSvc.js +++ b/contract/test/test-postalSvc.js @@ -51,10 +51,10 @@ const makeTestContext = async t => { /** @type {import('../tools/agd-lib.js').ExecSync} */ const dockerExec = (file, args, opts = { encoding: 'utf-8' }) => { - const workdir = '/workspace/contract'; - const execArgs = ['compose', 'exec', '--workdir', workdir, 'agd']; + const workdir = '/ws-agoric-basics/contract'; + const execArgs = ['exec', '--workdir', workdir, 'agd']; opts.verbose && - console.log('docker compose exec', JSON.stringify([file, ...args])); + console.log('docker exec', JSON.stringify([file, ...args])); return execFileSync('docker', [...execArgs, file, ...args], opts); }; diff --git a/contract/tools/e2e-tools.js b/contract/tools/e2e-tools.js index 4b5e6218..c13288f0 100644 --- a/contract/tools/e2e-tools.js +++ b/contract/tools/e2e-tools.js @@ -3,12 +3,14 @@ import { E, Far } from '@endo/far'; // eslint-disable-next-line import/no-extraneous-dependencies import { Nat } from '@endo/nat'; +import { exec } from 'child_process'; import { flags, makeAgd } from './agd-lib.js'; import { makeHttpClient, makeAPI } from './ui-kit-goals/makeHttpClient.js'; import { dedup, makeQueryKit, poll } from './ui-kit-goals/queryKit.js'; import { getBundleId } from './bundle-tools.js'; import { makeVStorage } from './ui-kit-goals/batchQuery.js'; + const BLD = '000000ubld'; const makeRunner = execFile => { @@ -103,6 +105,8 @@ const installBundle = async (fullPath, opts) => { const { chainId = 'agoriclocal', installer = 'user1' } = opts; const from = await agd.lookup(installer); + + const explainDelay = (ms, info) => { progress('follow', { ...info, delay: ms / 1000 }, '...'); return delay(ms); @@ -472,6 +476,7 @@ export const makeE2ETools = ( await null; /** @type {Record} */ const bundles = {}; + // Below we are creating bundles for each contract for (const [name, rootModPath] of Object.entries(bundleRoots)) { const bundle = await bundleCache.load(rootModPath, name); bundles[name] = bundle; @@ -496,6 +501,11 @@ export const makeE2ETools = ( const bundleSizeMb = (bundleJSON.length / 1_000_000).toFixed(3); progress('installing', name, shortId, bundleSizeMb, 'Mb'); + const containerId = 'agd'; // container is named agd + const localPath = './bundles'; + const containerPath = '/ws-agoric-basics/contract/'; + const command = `docker cp ${localPath} ${containerId}:${containerPath}`; + exec(command); const { tx, confirm } = await installBundle(fullPath, { id: shortId, agd, @@ -568,7 +578,13 @@ export const makeE2ETools = ( // not yet bundled } const detail = { evals: [eval0], title, description }; + // The following creates bundle scripts and jsons in bundles/ directory await runPackageScript('build:deployer', entryFile); + const containerId = 'agd'; // container is named agd + const localPath = './bundles'; + const containerPath = '/ws-agoric-basics/contract/'; + const command = `docker cp ${localPath} ${containerId}:${containerPath}`; + exec(command); const proposal = await runCoreEval(t, detail, { agd, blockTool }); await writeFile( `${eval0.code}.done`, diff --git a/docker-compose.yml b/docker-compose.yml index 9e45abd2..c373df52 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,9 +1,9 @@ -version: '3.5' services: agd: # cf. https://github.com/Agoric/agoric-3-proposals image: ghcr.io/agoric/agoric-3-proposals:latest + container_name: agd platform: linux/amd64 ports: - 26656:26656 @@ -12,6 +12,6 @@ services: environment: DEST: 1 DEBUG: "SwingSet:ls,SwingSet:vat" - volumes: - - .:/workspace - entrypoint: /workspace/contract/scripts/run-chain.sh + volumes: + - ./contract/scripts/run-chain.sh:/scripts/run-chain.sh + entrypoint: /scripts/run-chain.sh diff --git a/package.json b/package.json index 3db6cb45..e481988e 100644 --- a/package.json +++ b/package.json @@ -44,8 +44,8 @@ "start:docker": "cd contract && docker compose up -d", "stop:docker": "cd contract && docker compose down", "docker:logs": "cd contract; docker compose logs --tail 200 -f", - "docker:bash": "cd contract; docker compose exec agd bash", - "docker:make": "cd contract; docker compose exec agd make -C /workspace/contract", + "docker:bash": "cd contract; docker exec agd bash", + "docker:make": "cd contract; docker exec agd make -C /ws-agoric-basics/contract", "make:help": "make -C contract list", "start:contract": "cd contract && yarn start", "start:ui": "export VITE_HOSTNAME=$CODESPACE_NAME && export VITE_GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN=$GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN && cd ui && yarn dev",