Skip to content

Commit

Permalink
Merge pull request #1997 from Agoric/mfig/fix-sim-prices
Browse files Browse the repository at this point in the history
fix: properly generate a quote for the "player piano"
  • Loading branch information
michaelfig committed Nov 8, 2020
2 parents c943529 + a4f3973 commit 5c624ac
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 13 deletions.
9 changes: 6 additions & 3 deletions MAINTAINERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand Down
10 changes: 5 additions & 5 deletions packages/agoric-cli/lib/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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`,
Expand Down Expand Up @@ -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}`,
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion packages/marshal/src/marshal.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export { mustPassByRemote as mustPassByPresence };
*/
const remotableToInterface = new WeakMap();

/** @type {GetInterfaceOf} */
/** @type {MarshalGetInterfaceOf} */
export function getInterfaceOf(maybeRemotable) {
return remotableToInterface.get(maybeRemotable);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/marshal/src/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions packages/zoe/src/contracts/exported.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,9 @@
/**
* @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
* @property {(query: any, reply: any, requiredFee: Amount | undefined) => void} onReply
* notice a successful reply
*/

Expand Down
8 changes: 7 additions & 1 deletion packages/zoe/tools/fakePriceAuthority.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ export async function makeFakePriceAuthority(options) {
quotePayment: E(quoteMint).mintPayment(quoteAmount),
quoteAmount,
});
updater.updateState(quote);
return quote;
}

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 5c624ac

Please sign in to comment.