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

build: update dependencies to match dapp-offer-up (agoric-upgrade-13) #965

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
125 changes: 42 additions & 83 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,113 +33,72 @@
},
"homepage": "https://github.com/Agoric/documentation#readme",
"dependencies": {
"@agoric/zoe": "community-dev",
"@agoric/ertp": "community-dev",
"@endo/far": "^0.2.19",
"@endo/marshal": "^0.8.6",
"@endo/patterns": "^0.2.3",
"@endo/pass-style": "^0.1.6",
"typescript": "^4.0.3"
},
"devDependencies": {
"@agoric/assert": "community-dev",
"@agoric/cosmic-swingset": "community-dev",
"@agoric/ertp": "community-dev",
"@agoric/notifier": "community-dev",
"@agoric/solo": "community-dev",
"@agoric/vats": "community-dev",
"@agoric/ertp": "^0.16.3-u12.0",
"@agoric/notifier": "0.6.3-u13.0",
"@agoric/store": "0.9.3-u13.0",
"@agoric/zoe": "^0.26.3-u12.0",
"@agoric/zone": "^0.2.3-u13.0",
"@endo/bundle-source": "2.5.2-upstream-rollup",
"@endo/eventual-send": "^0.17.2",
"@endo/init": "^0.5.56",
"@endo/promise-kit": "^0.2.56",
"@endo/far": "^0.2.22",
"@endo/marshal": "^0.8.9",
"@endo/pass-style": "0.1.3",
"@endo/patterns": "^0.2.2",
"@endo/promise-kit": "^0.2.56"
},
"devDependencies": {
"@agoric/eslint-config": "^0.4.1-u12.0",
"@agoric/vats": "0.15.2-u13.0",
"@endo/eslint-plugin": "0.5.2",
"@endo/init": "0.5.56",
"@endo/ses-ava": "^0.2.40",
"@typescript-eslint/parser": "^4.26.0",
"ava": "^4.3.1",
"eslint": "^7.27.0",
"eslint-config-airbnb-base": "^14.2.1",
"@jessie.js/eslint-plugin": "0.4.0",
"@typescript-eslint/eslint-plugin": "^6.7.0",
"@typescript-eslint/parser": "^6.7.0",
"ava": "^5.3.0",
"eslint": "^8.47.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-jessie": "^0.0.6",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsdoc": "^35.1.2",
"eslint-plugin-prettier": "^3.4.0",
"import-meta-resolve": "^1.1.1",
"prettier": "^1.19.1",
"ses": "^0.18.8",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-ava": "^14.0.0",
"eslint-plugin-github": "^4.10.0",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-jsdoc": "^46.4.3",
"eslint-plugin-prettier": "^5.0.0",
"import-meta-resolve": "^2.2.1",
"prettier": "^3.0.3",
"prettier-plugin-jsdoc": "^1.0.0",
"typescript": "~5.2.2",
"vuepress": "^1.8.2",
"vuepress-plugin-check-md": "0.0.2"
},
"resolutions": {},
"globals": {
"harden": "readonly"
},
"ava": {
"files": [
"snippets/**/test-*.js"
],
"require": [
"@endo/init/debug.js"
],
"timeout": "10m"
},
"eslintConfig": {
"extends": [
"airbnb-base",
"plugin:prettier/recommended",
"plugin:jsdoc/recommended"
],
"parser": "@typescript-eslint/parser",
"env": {
"es6": true
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 2021
},
"globals": {
"assert": "readonly",
"harden": "readonly"
},
"rules": {
"implicit-arrow-linebreak": "off",
"function-paren-newline": "off",
"arrow-parens": "off",
"strict": "off",
"prefer-destructuring": "off",
"no-else-return": "off",
"no-console": "off",
"no-unused-vars": [
"error",
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_"
}
],
"no-return-assign": "off",
"no-param-reassign": "off",
"no-restricted-syntax": [
"off",
"ForOfStatement"
],
"no-unused-expressions": "off",
"no-loop-func": "off",
"no-inner-declarations": "off",
"import/prefer-default-export": "off",
"jsdoc/no-undefined-types": "off",
"jsdoc/require-jsdoc": "off",
"jsdoc/require-property-description": "off",
"jsdoc/require-param-description": "off",
"jsdoc/require-returns": "off",
"jsdoc/require-returns-description": "off",
"import/extensions": [
"error",
"always"
],
"import/no-extraneous-dependencies": [
"error",
{
"devDependencies": true
}
]
}
"extends": [
"@agoric"
]
},
"eslintIgnore": [
"bundle-*.js"
],
"prettier": {
"trailingComma": "all",
"arrowParens": "avoid",
"singleQuote": true
}
}
16 changes: 7 additions & 9 deletions snippets/ertp/guide/test-issuers-and-mints.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@ test('ertp guide issuers and mints makeIssuerKit', async t => {

test('ertp guide issuers and mints getBrand', async t => {
// #region getBrand
const { issuer: quatloosIssuer, brand: quatloosBrand } = makeIssuerKit(
'quatloos',
);
const { issuer: quatloosIssuer, brand: quatloosBrand } =
makeIssuerKit('quatloos');
// myQuatloosBrand === quatloosBrand
const myQuatloosBrand = quatloosIssuer.getBrand();
// #endregion getBrand
Expand Down Expand Up @@ -73,6 +72,7 @@ test('ertp guide issuers and mints makeEmptyPurse', async t => {
// The new empty purse contains 0 Quatloos
const quatloosPurse = quatloosIssuer.makeEmptyPurse();
// #endregion makeEmptyPurse
await null;
t.deepEqual(await quatloosPurse.getCurrentAmount(), {
brand: quatloosIssuer.getBrand(),
value: 0n,
Expand Down Expand Up @@ -213,9 +213,8 @@ test('ertp guide issuers and mints payment methods', async t => {

test('ertp guide issuers and mints mint.getIssuer', async t => {
// #region mintGetIssuer
const { issuer: quatloosIssuer, mint: quatloosMint } = makeIssuerKit(
'quatloos',
);
const { issuer: quatloosIssuer, mint: quatloosMint } =
makeIssuerKit('quatloos');
const quatloosMintIssuer = quatloosMint.getIssuer();
// returns true
const sameIssuer = quatloosIssuer === quatloosMintIssuer;
Expand All @@ -225,9 +224,8 @@ test('ertp guide issuers and mints mint.getIssuer', async t => {

test('ertp guide issuers and mints mint.mintPayment', async t => {
// #region mintMintPayment
const { mint: quatloosMint, brand: quatloosBrand } = makeIssuerKit(
'quatloos',
);
const { mint: quatloosMint, brand: quatloosBrand } =
makeIssuerKit('quatloos');
const quatloos1000 = AmountMath.make(quatloosBrand, 1000n);
const newPayment = quatloosMint.mintPayment(quatloos1000);
// #endregion mintMintPayment
Expand Down
9 changes: 6 additions & 3 deletions snippets/ertp/guide/test-purses-and-payments.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ import { test } from '../../prepare-test-env-ava.js';
import { AmountMath, makeIssuerKit } from '@agoric/ertp';

test('ertp guide purse getCurrentAmount', async t => {
const { issuer: quatloosIssuer, brand: quatloosBrand, mint } = makeIssuerKit(
'quatloos',
);
const {
issuer: quatloosIssuer,
brand: quatloosBrand,
mint,
} = makeIssuerKit('quatloos');

const quatloosPayment5 = mint.mintPayment(AmountMath.make(quatloosBrand, 5n));

Expand Down Expand Up @@ -34,6 +36,7 @@ test('ertp guide purse withdraw', async t => {
const newPayment = quatloosPurse.withdraw(AmountMath.make(brand, 3n));
// #endregion withdraw

await null;
t.deepEqual(await issuer.getAmountOf(newPayment), AmountMath.make(brand, 3n));
});

Expand Down
2 changes: 1 addition & 1 deletion snippets/prepare-test-env-ava.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
* `test` function.
*/

import '@endo/init/pre-bundle-source.js';
import '@agoric/zoe/tools/prepare-test-env.js';
// eslint-disable-next-line import/no-unresolved -- https://github.com/avajs/ava/issues/2951
import rawTest from 'ava';
// eslint-disable-next-line import/no-extraneous-dependencies
import { wrapTest } from '@endo/ses-ava';

export const test = wrapTest(rawTest);
7 changes: 6 additions & 1 deletion snippets/test-hardened-js.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// @jessie-check
/* global Compartment */
import { test } from './prepare-test-env-ava.js';

test('Counter Example', t => {
Expand Down Expand Up @@ -58,17 +57,21 @@ test('assign to frozen property fails', t => {
});

test('Date.now() is not available or returns NaN', t => {
// eslint-disable-next-line no-restricted-syntax
const c1 = new Compartment();
try {
t.is(c1.evaluate(`Date.now()`), NaN, 'legacy Date.now() is NaN');
} catch (e) {
// New API: throws instead of NaN.
// eslint-disable-next-line no-restricted-syntax
t.throws(() => c1.evaluate(`Date.now()`), { message: /^secure mode\b/ });
// eslint-disable-next-line no-restricted-syntax
t.throws(() => c1.evaluate(`new Date()`), { message: /^secure mode\b/ });
}
});

test('Math.random is not available', t => {
// eslint-disable-next-line no-restricted-syntax
const c1 = new Compartment();
t.throws(() => c1.evaluate(`Math.random()`));
});
Expand Down Expand Up @@ -157,6 +160,7 @@ test('cannot redefine includes method on Array', t => {
return false;
},
}),
// eslint-disable-next-line no-restricted-syntax
{ message: /read only property/ },
);
});
Expand Down Expand Up @@ -212,6 +216,7 @@ test('basic counter', t => {
t.is(c1.increment(), 3);
});

// eslint-disable-next-line no-restricted-syntax
const makeWeakMap = () => new WeakMap();

// region: makeMint0
Expand Down
20 changes: 7 additions & 13 deletions snippets/test-intro-zoe.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

import { test } from './prepare-test-env-ava.js';

import url from 'url';
import { resolve as importMetaResolve } from 'import-meta-resolve';
import { createRequire } from 'module';

import { E } from '@endo/eventual-send';
import { makeZoeKit } from '@agoric/zoe';
Expand All @@ -16,6 +15,8 @@ import bundleSource from '@endo/bundle-source';

import { makeFakeVatAdmin } from '@agoric/zoe/tools/fakeVatAdmin.js';

const nodeRequire = createRequire(import.meta.url);

test('intro to zoe', async t => {
const { zoeService: zoe } = makeZoeKit(makeFakeVatAdmin().admin);
const moolaKit = makeIssuerKit('moola');
Expand All @@ -34,11 +35,9 @@ test('intro to zoe', async t => {
});

// #region bundle
const atomicSwapUrl = await importMetaResolve(
const atomicSwapPath = await nodeRequire.resolve(
'@agoric/zoe/src/contracts/atomicSwap.js',
import.meta.url,
);
const atomicSwapPath = url.fileURLToPath(atomicSwapUrl);
const atomicSwapBundle = await bundleSource(atomicSwapPath);
// #endregion bundle

Expand Down Expand Up @@ -132,19 +131,14 @@ test('intro to zoe', async t => {

test('intro to zoe - contract-format', async t => {
const { zoeService: zoe } = makeZoeKit(makeFakeVatAdmin().admin);
const atomicSwapUrl = await importMetaResolve(
'./contract-format.js',
import.meta.url,
);
const atomicSwapPath = url.fileURLToPath(atomicSwapUrl);
const atomicSwapPath = await nodeRequire.resolve('./contract-format.js');
const atomicSwapBundle = await bundleSource(atomicSwapPath);
const atomicSwapInstallation = await E(zoe).install(atomicSwapBundle);
const { creatorInvitation } = await E(zoe).startInstance(
atomicSwapInstallation,
);
const invitationIssuer = await E(zoe).getInvitationIssuer();
const invitationAmount = await E(invitationIssuer).getAmountOf(
creatorInvitation,
);
const invitationAmount =
await E(invitationIssuer).getAmountOf(creatorInvitation);
t.deepEqual(invitationAmount.value[0].description, 'myInvitation');
});
27 changes: 16 additions & 11 deletions snippets/test-marshal.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { E, Far } from '@endo/far';
import { passStyleOf } from '@endo/pass-style';
import { makeCopyBag } from '@endo/patterns';

// eslint-disable-next-line import/no-extraneous-dependencies
import { makeFakeBoard } from '@agoric/vats/tools/board-utils.js';

// #region marshal-import
Expand Down Expand Up @@ -134,20 +135,21 @@ test.serial(
'marshal messages from E(zoe).install(), E(zoe).startInstance()',
async t => {
// #region marshal-messages-e
const { convertValToSlot, convertSlotToVal } = makeTranslationTable(
makeSlot1,
);
const { convertValToSlot, convertSlotToVal } =
makeTranslationTable(makeSlot1);
const m = makeMarshal(convertValToSlot, convertSlotToVal, smallCaps);

const outgoingMessageQueue = [];
// E work-alike for illustration
const E2 = obj =>
new Proxy(obj, {
get: (target, method) => (...args) => {
const msg = harden([target, [method, args]]);
outgoingMessageQueue.push(m.toCapData(msg));
return new Promise(_resolve => {});
},
get:
(target, method) =>
(...args) => {
const msg = harden([target, [method, args]]);
outgoingMessageQueue.push(m.toCapData(msg));
return new Promise(_resolve => {});
},
});
// #endregion marshal-messages-e

Expand All @@ -159,8 +161,7 @@ test.serial(
harden(startP); // suppress usage lint
t.deepEqual(outgoingMessageQueue, [
{
body:
'#["$0.Alleged: ZoeService",["install",[{"bundleFormat":"xyz"}]]]',
body: '#["$0.Alleged: ZoeService",["install",[{"bundleFormat":"xyz"}]]]',
slots: ['object0'],
},
{
Expand Down Expand Up @@ -207,7 +208,11 @@ test.serial(
const makeRecorder = (parent, name, m) => {
const node = parent.makeChildNode(name);
return harden({
write: async val => node.setValue(await E(m).toCapData(val)),
write: async val =>
E(m)
.toCapData(val)
// @ts-expect-error mock
.then(data => node.setValue(data)),
});
};

Expand Down
Loading
Loading