From 0c18aaee67d4e1c530d632c3b69edbcca6ce8fb7 Mon Sep 17 00:00:00 2001 From: Michael FIG Date: Sat, 7 Nov 2020 17:41:18 -0600 Subject: [PATCH 1/3] fix: properly generate a quote for every timer tick --- MAINTAINERS.md | 9 ++++++--- packages/zoe/tools/fakePriceAuthority.js | 8 +++++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/MAINTAINERS.md b/MAINTAINERS.md index 2a97e9d61d4..6b6d6219a4f 100644 --- a/MAINTAINERS.md +++ b/MAINTAINERS.md @@ -18,14 +18,17 @@ git push -u origin release-$now scripts/have-news HEAD^ > have-news.md ``` -Then, create a release PR, pasting `have-news.md` into the body. - -Then, once tests pass, you can run the following: +Create a release PR, pasting `have-news.md` into the body. Then build the SDK: ```sh # Build all package generated files. yarn install yarn build +``` + +Once tests pass, you can publish to NPM with the following: + +```sh # Publish to NPM. NOTE: You may have to repeat this several times if there are failures. yarn lerna publish from-package ``` diff --git a/packages/zoe/tools/fakePriceAuthority.js b/packages/zoe/tools/fakePriceAuthority.js index 0d2c49832b3..a52827042ad 100644 --- a/packages/zoe/tools/fakePriceAuthority.js +++ b/packages/zoe/tools/fakePriceAuthority.js @@ -111,7 +111,6 @@ export async function makeFakePriceAuthority(options) { quotePayment: E(quoteMint).mintPayment(quoteAmount), quoteAmount, }); - updater.updateState(quote); return quote; } @@ -141,6 +140,13 @@ export async function makeFakePriceAuthority(options) { } else { currentPriceIndex += 1; } + const [tradeValueIn] = currentTrade(); + const rawQuote = priceInQuote( + mathIn.make(tradeValueIn), + mathOut.getBrand(), + t, + ); + updater.updateState(rawQuote); for (const req of comparisonQueue) { // eslint-disable-next-line no-await-in-loop const priceQuote = priceInQuote(req.amountIn, req.brandOut, t); From b8169c1f39bc0c0d7c07099df2ac23ee7df05733 Mon Sep 17 00:00:00 2001 From: Michael FIG Date: Sat, 7 Nov 2020 23:19:01 -0600 Subject: [PATCH 2/3] fix: minor tweaks for dapp-oracle --- packages/agoric-cli/lib/start.js | 10 +++++----- packages/marshal/src/marshal.js | 2 +- packages/marshal/src/types.js | 2 +- packages/zoe/src/contracts/exported.js | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/agoric-cli/lib/start.js b/packages/agoric-cli/lib/start.js index 6c4934526da..8c591d4a51c 100644 --- a/packages/agoric-cli/lib/start.js +++ b/packages/agoric-cli/lib/start.js @@ -34,7 +34,7 @@ export default async function startMain(progname, rawArgs, powers, opts) { cargs, { stdio = 'inherit', env = pspawnEnv, ...rest } = {}, ) => { - log.debug(chalk.blueBright(cmd, ...cargs)); + log(chalk.blueBright(cmd, ...cargs)); const cp = spawn(cmd, cargs, { stdio, env, ...rest }); const pr = new Promise((resolve, _reject) => { cp.on('exit', resolve); @@ -56,7 +56,7 @@ export default async function startMain(progname, rawArgs, powers, opts) { 'run', `--volume=${process.cwd()}:/usr/src/dapp`, `--rm`, - `-it`, + // `-it`, `--entrypoint=ag-cosmos-helper`, 'agoric/agoric-sdk', `--home=/usr/src/dapp/_agstate/keys`, @@ -211,7 +211,7 @@ export default async function startMain(progname, rawArgs, powers, opts) { `--volume=${process.cwd()}:/usr/src/dapp`, `--rm`, ...dockerArgs, - `-it`, + // `-it`, SDK_IMAGE, ...args, `--home=/usr/src/dapp/${agServer}`, @@ -298,7 +298,7 @@ export default async function startMain(progname, rawArgs, powers, opts) { if (exitStatus) { return exitStatus; } - exitStatus = await fs.writeFile(`${genesisFile}.stamp`, Date.now()); + exitStatus = await fs.writeFile(`${genesisFile}.stamp`, `${Date.now()}`); if (exitStatus) { return exitStatus; } @@ -383,7 +383,7 @@ export default async function startMain(progname, rawArgs, powers, opts) { `--volume=${process.env.HOME}/.agoric:/root/.agoric`, `-eAG_SOLO_BASEDIR=/usr/src/dapp/${agServer}`, `--rm`, - `-it`, + // `-it`, `--entrypoint=/usr/src/app/bin/ag-solo`, ...dockerArgs, SOLO_IMAGE, diff --git a/packages/marshal/src/marshal.js b/packages/marshal/src/marshal.js index 02f9f55af17..6332d64e511 100644 --- a/packages/marshal/src/marshal.js +++ b/packages/marshal/src/marshal.js @@ -21,7 +21,7 @@ export { mustPassByRemote as mustPassByPresence }; */ const remotableToInterface = new WeakMap(); -/** @type {GetInterfaceOf} */ +/** @type {MarshalGetInterfaceOf} */ export function getInterfaceOf(maybeRemotable) { return remotableToInterface.get(maybeRemotable); } diff --git a/packages/marshal/src/types.js b/packages/marshal/src/types.js index bf030795a55..126d8b9df69 100644 --- a/packages/marshal/src/types.js +++ b/packages/marshal/src/types.js @@ -139,7 +139,7 @@ */ /** - * @callback GetInterfaceOf + * @callback MarshalGetInterfaceOf * Simple semantics, just tell what interface (or undefined) a remotable has. * * @param {*} maybeRemotable the value to check diff --git a/packages/zoe/src/contracts/exported.js b/packages/zoe/src/contracts/exported.js index 7dcf9065686..179ab1f994f 100644 --- a/packages/zoe/src/contracts/exported.js +++ b/packages/zoe/src/contracts/exported.js @@ -185,7 +185,7 @@ /** * @typedef {Object} OracleHandler * @property {(query: any, fee: Amount) => Promise<{ reply: - * any, requiredFee: Amount }>} onQuery callback to reply to a query + * any, requiredFee: Amount | undefined }>} onQuery callback to reply to a query * @property {(query: any, reason: any) => void} onError notice an error * @property {(query: any, reply: any, requiredFee: Amount) => void} onReply * notice a successful reply From a4f3973d33e9bf4a738753b13c9d6c512248f9c7 Mon Sep 17 00:00:00 2001 From: Michael FIG Date: Sat, 7 Nov 2020 23:32:01 -0600 Subject: [PATCH 3/3] chore: type fix --- packages/zoe/src/contracts/exported.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/zoe/src/contracts/exported.js b/packages/zoe/src/contracts/exported.js index 179ab1f994f..108d96690bc 100644 --- a/packages/zoe/src/contracts/exported.js +++ b/packages/zoe/src/contracts/exported.js @@ -187,7 +187,7 @@ * @property {(query: any, fee: Amount) => Promise<{ reply: * any, requiredFee: Amount | undefined }>} onQuery callback to reply to a query * @property {(query: any, reason: any) => void} onError notice an error - * @property {(query: any, reply: any, requiredFee: Amount) => void} onReply + * @property {(query: any, reply: any, requiredFee: Amount | undefined) => void} onReply * notice a successful reply */