From e698700bd12caca29ba29c75815053f2ac96f605 Mon Sep 17 00:00:00 2001 From: Dan Connolly Date: Wed, 29 Nov 2023 10:27:28 -0600 Subject: [PATCH 01/10] build: move zoe to dependencies (should be contractSupport) --- contract/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contract/package.json b/contract/package.json index 90a0072..c23cb6d 100644 --- a/contract/package.json +++ b/contract/package.json @@ -23,7 +23,6 @@ "@endo/eslint-plugin": "^0.5.1", "@endo/init": "^0.5.59", "@endo/ses-ava": "^0.2.43", - "@agoric/zoe": "^0.26.2", "@agoric/deploy-script-support": "^0.10.3", "@jessie.js/eslint-plugin": "^0.4.0", "@typescript-eslint/eslint-plugin": "^6.7.0", @@ -50,6 +49,7 @@ }, "dependencies": { "@agoric/ertp": "^0.16.2", + "@agoric/zoe": "^0.26.2", "@endo/far": "^0.2.21", "@endo/marshal": "^0.8.9", "@endo/patterns": "^0.2.5" From 6f47b8d9bfbe45c94bd26965e0efe65ba1c9ca20 Mon Sep 17 00:00:00 2001 From: Dan Connolly Date: Wed, 29 Nov 2023 10:24:16 -0600 Subject: [PATCH 02/10] fix: use atomicRearrange rather that staging the helper function is compatible with mainnet1B --- contract/src/gameAssetContract.js | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/contract/src/gameAssetContract.js b/contract/src/gameAssetContract.js index f54dbf8..14c8464 100644 --- a/contract/src/gameAssetContract.js +++ b/contract/src/gameAssetContract.js @@ -1,11 +1,14 @@ -/** @file illustrates using non-vbank assets */ -/* eslint @typescript-eslint/no-floating-promises: "warn" */ +/** @file Contract to mint and sell Place NFTs for a hypothetical game. */ +// @ts-check -// deep import to avoid dependency on all of ERTP, vat-data import { AmountShape } from '@agoric/ertp/src/typeGuards.js'; import { AmountMath, AssetKind } from '@agoric/ertp/src/amountMath.js'; import { M, getCopyBagEntries } from '@endo/patterns'; -import { E, Far } from '@endo/far'; +import { Far } from '@endo/far'; +// Use the deprecated atomicRearrange API +// for compatibility with mainnet1B. +import { atomicRearrange } from '@agoric/zoe/src/contractSupport/atomicTransfer.js'; +import '@agoric/zoe/exported.js'; import { makeTracer } from './debug.js'; @@ -46,12 +49,12 @@ export const start = async zcf => { totalPlaces(want.Places) <= 3n || Fail`only 3 places allowed when joining`; - // We use the deprecated stage/reallocate API - // so that we can test this with the version of zoe on mainnet1B. - playerSeat.decrementBy(gameSeat.incrementBy(give)); const tmp = mint.mintGains(want); - playerSeat.incrementBy(tmp.decrementBy(want)); - zcf.reallocate(playerSeat, tmp, gameSeat); + atomicRearrange(zcf, [ + [playerSeat, gameSeat, give], + [tmp, playerSeat, want], + ]); + playerSeat.exit(true); return 'welcome to the game'; }; From 818069249d9cffa7ac55a03e303b38992a65fd0b Mon Sep 17 00:00:00 2001 From: Dan Connolly Date: Tue, 28 Nov 2023 22:50:35 -0600 Subject: [PATCH 03/10] test(contract): don't expect to import centralSupplyBundle use bundleSource() and a cache --- contract/test/test-contract.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/contract/test/test-contract.js b/contract/test/test-contract.js index 5f742dc..ad1cce0 100644 --- a/contract/test/test-contract.js +++ b/contract/test/test-contract.js @@ -2,19 +2,20 @@ /* eslint-disable import/order -- https://github.com/endojs/endo/issues/1235 */ import { test as anyTest } from './prepare-test-env-ava.js'; -import url from 'url'; +import { createRequire } from 'module'; import bundleSource from '@endo/bundle-source'; +import { unsafeMakeBundleCache } from '@agoric/swingset-vat/tools/bundleTool.js'; import { E } from '@endo/far'; import { makeCopyBag } from '@endo/patterns'; import { AmountMath } from '@agoric/ertp'; import { makeZoeKitForTest } from '@agoric/zoe/tools/setup-zoe.js'; -import centralSupplyBundle from '@agoric/vats/bundles/bundle-centralSupply.js'; import { mintStablePayment } from './mintStable.js'; -/** @param {string} ref */ -const asset = ref => url.fileURLToPath(new URL(ref, import.meta.url)); +const myRequire = createRequire(import.meta.url); +/** @param {string} specifier */ +const asset = specifier => myRequire.resolve(specifier); const contractPath = asset(`../src/gameAssetContract.js`); @@ -30,9 +31,15 @@ const CENT = UNIT6 / 100n; * @param {unknown} _t */ const makeTestContext = async _t => { + const bundleCache = await unsafeMakeBundleCache('bundles/'); const bundle = await bundleSource(contractPath); const { zoeService: zoe, feeMintAccess } = makeZoeKitForTest(); + const centralSupplyBundle = await bundleCache.load( + asset('@agoric/vats/src/centralSupply.js'), + 'centralSupply', + ); + const centralSupply = await E(zoe).install(centralSupplyBundle); const stableIssuer = await E(zoe).getFeeIssuer(); @@ -53,7 +60,7 @@ const makeTestContext = async _t => { return { zoe, bundle, faucet }; }; -test.before(async t => (t.context = await makeTestContext())); +test.before(async t => (t.context = await makeTestContext(t))); test('buy some game places', async t => { const { zoe, bundle, faucet } = t.context; From 3d872bbbbd9571feae0c46097a272346d3f42f07 Mon Sep 17 00:00:00 2001 From: Dan Connolly Date: Tue, 28 Nov 2023 22:47:02 -0600 Subject: [PATCH 04/10] build(contract): update endo deps to match agoric-sdk --- contract/package.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/contract/package.json b/contract/package.json index c23cb6d..d28ad63 100644 --- a/contract/package.json +++ b/contract/package.json @@ -19,11 +19,11 @@ "lint-jessie": "eslint -c '.eslintrc-jessie.js' '**/*.{js,jsx}'" }, "devDependencies": { - "@endo/bundle-source": "^2.7.0", - "@endo/eslint-plugin": "^0.5.1", - "@endo/init": "^0.5.59", - "@endo/ses-ava": "^0.2.43", "@agoric/deploy-script-support": "^0.10.3", + "@endo/bundle-source": "^2.8.0", + "@endo/eslint-plugin": "^0.5.2", + "@endo/init": "^0.5.60", + "@endo/ses-ava": "^0.2.44", "@jessie.js/eslint-plugin": "^0.4.0", "@typescript-eslint/eslint-plugin": "^6.7.0", "@typescript-eslint/parser": "^6.7.0", @@ -50,7 +50,7 @@ "dependencies": { "@agoric/ertp": "^0.16.2", "@agoric/zoe": "^0.26.2", - "@endo/far": "^0.2.21", + "@endo/far": "^0.2.22", "@endo/marshal": "^0.8.9", "@endo/patterns": "^0.2.5" }, From 2233d1cc31e0b9216fbae0fc13ed6ff4ab504156 Mon Sep 17 00:00:00 2001 From: Dan Connolly Date: Tue, 28 Nov 2023 22:47:25 -0600 Subject: [PATCH 05/10] build(contract): update @agoric deps to match npm --- contract/package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/contract/package.json b/contract/package.json index d28ad63..c64e097 100644 --- a/contract/package.json +++ b/contract/package.json @@ -19,7 +19,7 @@ "lint-jessie": "eslint -c '.eslintrc-jessie.js' '**/*.{js,jsx}'" }, "devDependencies": { - "@agoric/deploy-script-support": "^0.10.3", + "@agoric/deploy-script-support": "^0.10.4-u12.0", "@endo/bundle-source": "^2.8.0", "@endo/eslint-plugin": "^0.5.2", "@endo/init": "^0.5.60", @@ -48,8 +48,8 @@ "@babel/highlight": "7.22.5" }, "dependencies": { - "@agoric/ertp": "^0.16.2", - "@agoric/zoe": "^0.26.2", + "@agoric/zoe": "^0.26.3-u12.0", + "@agoric/ertp": "^0.16.3-u12.0", "@endo/far": "^0.2.22", "@endo/marshal": "^0.8.9", "@endo/patterns": "^0.2.5" From 59fc59647348d0ddeda755ac9e42a38fd2370e0c Mon Sep 17 00:00:00 2001 From: Dan Connolly Date: Tue, 28 Nov 2023 22:49:58 -0600 Subject: [PATCH 06/10] build(ui): prune contract scripts --- ui/package.json | 7 ------- 1 file changed, 7 deletions(-) diff --git a/ui/package.json b/ui/package.json index 30be7ea..d4ae035 100644 --- a/ui/package.json +++ b/ui/package.json @@ -6,13 +6,6 @@ "scripts": { "dev": "vite", "build": "tsc && vite build", - "build:contract": "cd contract; yarn", - "build:proposal": "yarn build:contract; HOME=$PWD/dist; cd contract; yarn build:proposal", - "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", - "make:help": "echo 'USAGE: yarn docker:make TARGET\nwhere TARGET is one of...'; cd contract; make list", "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", "preview": "vite preview" }, From 913ba52580daf8ceed3593d0d0f02bc79479e1a9 Mon Sep 17 00:00:00 2001 From: Dan Connolly Date: Tue, 28 Nov 2023 22:50:09 -0600 Subject: [PATCH 07/10] build(ui): add noop test script --- ui/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/ui/package.json b/ui/package.json index d4ae035..646211a 100644 --- a/ui/package.json +++ b/ui/package.json @@ -6,6 +6,7 @@ "scripts": { "dev": "vite", "build": "tsc && vite build", + "test": "exit 0", "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", "preview": "vite preview" }, From d96fb889061bf10f6293c2dcdf3032604109a7a0 Mon Sep 17 00:00:00 2001 From: Dan Connolly Date: Tue, 28 Nov 2023 22:49:26 -0600 Subject: [PATCH 08/10] build: don't require `agoric install` --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index 744fe84..6e499c7 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,6 @@ "@babel/highlight": "7.22.5" }, "scripts": { - "preinstall": "node -e \"process.env.AGORIC_INSTALL && process.exit(0); console.warn('please use: agoric install . For details, see https://agoric.com/documentation/'); process.exit(1)\"", "lint": "yarn workspaces run lint", "test": "yarn workspaces run test", "build": "yarn workspaces run build" From 0a7b78bf0048bba33099e1b6d7bbce842f5cd0ca Mon Sep 17 00:00:00 2001 From: Dan Connolly Date: Wed, 29 Nov 2023 10:23:34 -0600 Subject: [PATCH 09/10] docs: don't require `agoric install` --- README.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/README.md b/README.md index c1d4b0f..e1d4690 100644 --- a/README.md +++ b/README.md @@ -16,9 +16,6 @@ On top of that, we add Prerequisites: `agoric` CLI from [Installing the Agoric SDK](https://docs.agoric.com/guides/getting-started/). _Work is in progress to address [#3857](https://github.com/Agoric/agoric-sdk/issues/3857), making installing from npm more stragithforward._ ```sh -agoric --version -agoric install -cd contract yarn yarn test ``` From 4ef30050ca7e5f035886abfa4f2e917cd1495d9e Mon Sep 17 00:00:00 2001 From: Dan Connolly Date: Wed, 29 Nov 2023 10:44:05 -0600 Subject: [PATCH 10/10] build: lock updated packages --- yarn.lock | 95 +++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 67 insertions(+), 28 deletions(-) diff --git a/yarn.lock b/yarn.lock index a3c7d0b..df10942 100644 --- a/yarn.lock +++ b/yarn.lock @@ -74,25 +74,25 @@ dependencies: protobufjs "^7.0.0" -"@agoric/deploy-script-support@^0.10.3": - version "0.10.3" - resolved "https://registry.yarnpkg.com/@agoric/deploy-script-support/-/deploy-script-support-0.10.3.tgz#6c0d3e7869b7f3abe1814a07332d2d39e05d53c7" - integrity sha512-X4Ory0ildhpDNVO5l64nA1MQqepTR8jGICp7EJisSE2sWRPaDX3Wy+Y/K8JPKoETBhxgw7w1Nt0nay6UEl18Tg== +"@agoric/deploy-script-support@^0.10.4-u12.0": + version "0.10.4-u12.0" + resolved "https://registry.yarnpkg.com/@agoric/deploy-script-support/-/deploy-script-support-0.10.4-u12.0.tgz#6f92da96b9689d11957864eb84180fadab704b2b" + integrity sha512-d6E9Uqd/yEKY5fmKCBF0LPZGcWjeCjIofA6uDfcNw72BLerj/wjkXTZDAz4cIOFYjYkDdXD40sTIHaaRiMLGLg== dependencies: - "@agoric/assert" "^0.6.0" - "@agoric/ertp" "^0.16.2" - "@agoric/import-manager" "^0.3.11" - "@agoric/internal" "^0.3.2" - "@agoric/notifier" "^0.6.2" - "@agoric/store" "^0.9.2" - "@agoric/zoe" "^0.26.2" - "@endo/base64" "^0.2.31" - "@endo/bundle-source" "^2.5.1" - "@endo/far" "^0.2.18" - "@endo/marshal" "^0.8.5" - "@endo/nat" "^4.1.27" - "@endo/promise-kit" "^0.2.56" - "@endo/zip" "^0.2.31" + "@agoric/assert" "^0.6.1-u11wf.0" + "@agoric/ertp" "^0.16.3-u12.0" + "@agoric/import-manager" "^0.3.12-u12.0" + "@agoric/internal" "^0.4.0-u12.0" + "@agoric/notifier" "^0.6.3-u12.0" + "@agoric/store" "^0.9.3-u12.0" + "@agoric/zoe" "^0.26.3-u12.0" + "@endo/base64" "0.2.31" + "@endo/bundle-source" "2.5.2-upstream-rollup" + "@endo/far" "0.2.18" + "@endo/marshal" "0.8.5" + "@endo/nat" "4.1.27" + "@endo/promise-kit" "0.2.56" + "@endo/zip" "0.2.31" "@agoric/ertp@^0.16.2": version "0.16.2" @@ -110,6 +110,22 @@ "@endo/nat" "^4.1.27" "@endo/promise-kit" "^0.2.56" +"@agoric/ertp@^0.16.3-u12.0": + version "0.16.3-u12.0" + resolved "https://registry.yarnpkg.com/@agoric/ertp/-/ertp-0.16.3-u12.0.tgz#276efde19131d1f3a339e7d98efee064d9d4ebec" + integrity sha512-g9dzcY94SuOdMi+RGYAffOVA/BmSzTv/t4KzKwZlAUZrgZ2E88z6REnpkvdzT5fK9M+D5PHejjbfwQnyx6upPA== + dependencies: + "@agoric/assert" "^0.6.1-u11wf.0" + "@agoric/notifier" "^0.6.3-u12.0" + "@agoric/store" "^0.9.3-u12.0" + "@agoric/swingset-vat" "^0.32.3-u12.0" + "@agoric/vat-data" "^0.5.3-u12.0" + "@endo/eventual-send" "0.17.2" + "@endo/far" "0.2.18" + "@endo/marshal" "0.8.5" + "@endo/nat" "4.1.27" + "@endo/promise-kit" "0.2.56" + "@agoric/eventual-send@^0.14.1": version "0.14.1" resolved "https://registry.yarnpkg.com/@agoric/eventual-send/-/eventual-send-0.14.1.tgz#b414888bed67cf003a61bd22da30a70f79b8f9dc" @@ -137,10 +153,10 @@ "@endo/nat" "^4.1.27" "@endo/promise-kit" "^0.2.56" -"@agoric/import-manager@^0.3.11": - version "0.3.11" - resolved "https://registry.yarnpkg.com/@agoric/import-manager/-/import-manager-0.3.11.tgz#132ccd031e1036fac7711738f0606d9053b5ddd4" - integrity sha512-GnW+rsuV0F7qHYrZrL4PmOkvNtu6FPG7z9kctfjBE41UNYLC1Frd3zIquoo1vKLiSEOZEdwPWO8tE8nIk5/1Bw== +"@agoric/import-manager@^0.3.12-u12.0": + version "0.3.12-u12.0" + resolved "https://registry.yarnpkg.com/@agoric/import-manager/-/import-manager-0.3.12-u12.0.tgz#0c3e5144ce35c64e2208c2373eafff72ba512f9d" + integrity sha512-p5Cyf8uEpUwsHlRCUSQUnM7rVdn/VBk0vMceo2A4ESKT127HmhYhbggx/4KzmcweU1miFvONglIRcdCyN52EHQ== "@agoric/inter-protocol@^0.16.1": version "0.16.1" @@ -208,7 +224,7 @@ "@endo/marshal" "^0.8.5" "@endo/promise-kit" "^0.2.56" -"@agoric/notifier@^0.6.3-dev-8c14632.0": +"@agoric/notifier@^0.6.3-dev-8c14632.0", "@agoric/notifier@^0.6.3-u12.0": version "0.6.3-u12.0" resolved "https://registry.yarnpkg.com/@agoric/notifier/-/notifier-0.6.3-u12.0.tgz#521393a073ca7f5c900af3dd818061a928d26089" integrity sha512-9axwVeBHTZhvkSeK73+xDaEQAYk75tIH71/Diw98rohWiaJ2ZcHZgiwlgn4CLC+++bY312cxAGKDiuLtU6CedA== @@ -620,6 +636,29 @@ "@endo/patterns" "^0.2.2" "@endo/promise-kit" "^0.2.56" +"@agoric/zoe@^0.26.3-u12.0": + version "0.26.3-u12.0" + resolved "https://registry.yarnpkg.com/@agoric/zoe/-/zoe-0.26.3-u12.0.tgz#ca478b7f5219ae2c8ec20f9a85aca1facd8e6ec0" + integrity sha512-OznJJxbzRvOy4E8NJc3/zqasCleTJ8in/7ebrw7DyQAYaHg4e4wsV7a/Uuy1BUbB0h061saqVlhOM9xg1r0zhg== + dependencies: + "@agoric/assert" "^0.6.1-u11wf.0" + "@agoric/ertp" "^0.16.3-u12.0" + "@agoric/internal" "^0.4.0-u12.0" + "@agoric/notifier" "^0.6.3-u12.0" + "@agoric/store" "^0.9.3-u12.0" + "@agoric/swingset-vat" "^0.32.3-u12.0" + "@agoric/time" "^0.3.3-u12.0" + "@agoric/vat-data" "^0.5.3-u12.0" + "@endo/bundle-source" "2.5.2-upstream-rollup" + "@endo/captp" "3.1.1" + "@endo/eventual-send" "0.17.2" + "@endo/far" "0.2.18" + "@endo/import-bundle" "0.3.4" + "@endo/marshal" "0.8.5" + "@endo/nat" "4.1.27" + "@endo/patterns" "0.2.2" + "@endo/promise-kit" "0.2.56" + "@agoric/zone@^0.2.2": version "0.2.2" resolved "https://registry.yarnpkg.com/@agoric/zone/-/zone-0.2.2.tgz#df5cc091d4a83842b87888e74159a723a424a82e" @@ -1115,7 +1154,7 @@ rollup "^2.79.1" source-map "^0.7.3" -"@endo/bundle-source@^2.5.1", "@endo/bundle-source@^2.7.0": +"@endo/bundle-source@^2.5.1", "@endo/bundle-source@^2.8.0": version "2.8.0" resolved "https://registry.yarnpkg.com/@endo/bundle-source/-/bundle-source-2.8.0.tgz#56f25b3d9c74d3d0bede5c526647aaf02c0a8f94" integrity sha512-nDiM3u/LKWq5xAnJ+zm35HC6kMKF3IG6Y5V0385slFHZVT8mXzRJ5ztEqRsVzvVeITfz3ZRFOaFer6v4V8Lkjg== @@ -1211,7 +1250,7 @@ resolved "https://registry.yarnpkg.com/@endo/env-options/-/env-options-0.1.4.tgz#e516bc3864f00b154944e444fb8996a9a0c23a45" integrity sha512-Ol8ct0aW8VK1ZaqntnUJfrYT59P6Xn36XPbHzkqQhsYkpudKDn5ILYEwGmSO/Ff+XJjv/pReNI0lhOyyrDa9mg== -"@endo/eslint-plugin@^0.5.1": +"@endo/eslint-plugin@^0.5.2": version "0.5.2" resolved "https://registry.yarnpkg.com/@endo/eslint-plugin/-/eslint-plugin-0.5.2.tgz#835d22e9ff17d9935f7f565e50a21ef07aa92ca2" integrity sha512-WzQmzBXoGGm5vb2mX/Ho9dS5wSaajmeE2PnFqiBUwPQ5ml7B0T7/QwzV5MSAv1ClyzDt3t5j36ENWxeibb2C9Q== @@ -1259,7 +1298,7 @@ "@endo/eventual-send" "^0.17.2" "@endo/pass-style" "^0.1.3" -"@endo/far@^0.2.18", "@endo/far@^0.2.21", "@endo/far@^0.2.22", "@endo/far@^0.2.3": +"@endo/far@^0.2.18", "@endo/far@^0.2.22", "@endo/far@^0.2.3": version "0.2.22" resolved "https://registry.yarnpkg.com/@endo/far/-/far-0.2.22.tgz#fda187289a903ee3f9d6dcc5664ee7fef1994b1f" integrity sha512-LFOicqyHslKOSk/H5EfGOcw347ftDSwYHARPasnrG4UJOEkcU1ZG5bN/BmfONtcidB776gWZKrV/tNl4WLIlyw== @@ -1293,7 +1332,7 @@ "@endo/lockdown" "^0.1.28" "@endo/promise-kit" "^0.2.56" -"@endo/init@^0.5.56", "@endo/init@^0.5.59", "@endo/init@^0.5.60": +"@endo/init@^0.5.56", "@endo/init@^0.5.60": version "0.5.60" resolved "https://registry.yarnpkg.com/@endo/init/-/init-0.5.60.tgz#e78051b13cd4a04c72d5ec1d2a6011b7f987f7ff" integrity sha512-AbAvs6Nk01fyJ+PaW0RzwemIWyomjzDf8ZEhVa3jCOhr8kBBsTnJdX0v7XkbZ/Y8NQxlrFaW0fPqlJK6aMWTlQ== @@ -1413,7 +1452,7 @@ dependencies: ses "^0.18.4" -"@endo/ses-ava@^0.2.43": +"@endo/ses-ava@^0.2.44": version "0.2.44" resolved "https://registry.yarnpkg.com/@endo/ses-ava/-/ses-ava-0.2.44.tgz#b97b0d5a457b30b73c74b19091d67840984cf47e" integrity sha512-Pp0os/ZN7r0L94eCxWFYhSWt+DIdIASIVlY4oYCwMLxLa28cuswCjRQvPKLINBpZezogCKKptEWJTyHhGWpVQw==