Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Agoric/agoric-sdk
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 68550623de6949f4cd9917d870fe1dc3f9a848e9
Choose a base ref
..
head repository: Agoric/agoric-sdk
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: c3f5438038ee7841ff4ea065a17befd697cf6601
Choose a head ref
14 changes: 11 additions & 3 deletions a3p-integration/proposals/z:acceptance/core-eval.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
/* global setTimeout */

import test from 'ava';
import { readFile, writeFile } from 'node:fs/promises';

import { agd, evalBundles, waitForBlock } from '@agoric/synthetic-chain';
import { agd, evalBundles } from '@agoric/synthetic-chain';
import { retryUntilCondition } from './test-lib/sync-tools.js';

const SUBMISSION_DIR = 'core-eval-test-submission';

@@ -45,7 +48,12 @@ test(`core eval works`, async t => {

await evalBundles(SUBMISSION_DIR);

await waitForBlock(2); // enough time for core eval to execute ?
const actualValue = await retryUntilCondition(
async () => readPublished(nodePath),
value => value === nodeValue,
'core eval not processed yet',
{ setTimeout, retryIntervalMs: 5000, maxRetries: 15 },
);

t.is(await readPublished(nodePath), nodeValue);
t.is(actualValue, nodeValue);
});
98 changes: 0 additions & 98 deletions a3p-integration/proposals/z:acceptance/exitOffer.js

This file was deleted.

15 changes: 11 additions & 4 deletions a3p-integration/proposals/z:acceptance/localchain.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import test from 'ava';
/* global setTimeout */

import { agd, evalBundles, waitForBlock } from '@agoric/synthetic-chain';
import test from 'ava';
import { agd, evalBundles } from '@agoric/synthetic-chain';
import { retryUntilCondition } from './test-lib/sync-tools.js';

const SUBMISSION_DIR = 'localchaintest-submission';

@@ -27,7 +29,12 @@ test(`localchain passes tests`, async t => {
const nodePath = 'test.localchain';
const nodeValue = JSON.stringify({ success: true });

await waitForBlock(2); // enough time for core eval to execute ?
const actualValue = await retryUntilCondition(
async () => readPublished(nodePath),
value => value === nodeValue,
'core eval not processed yet',
{ setTimeout, retryIntervalMs: 5000, maxRetries: 15 },
);

t.is(await readPublished(nodePath), nodeValue);
t.is(actualValue, nodeValue);
});
40 changes: 18 additions & 22 deletions a3p-integration/proposals/z:acceptance/valueVow.test.js
Original file line number Diff line number Diff line change
@@ -9,12 +9,12 @@ import '@endo/init/debug.js';
import {
evalBundles,
getIncarnation,
waitForBlock,
GOV1ADDR as GETTER, // not particular to governance, just a handy wallet
GOV2ADDR as SETTER, // not particular to governance, just a handy wallet
} from '@agoric/synthetic-chain';
import { makeWalletUtils } from './test-lib/wallet.js';
import { networkConfig } from './test-lib/index.js';
import { retryUntilCondition } from './test-lib/sync-tools.js';

const START_VALUEVOW_DIR = 'start-valueVow';
const RESTART_VALUEVOW_DIR = 'restart-valueVow';
@@ -44,21 +44,21 @@ test('vow survives restart', async t => {
});

t.log('confirm the value is not in offer results');
await waitForBlock(2);
{
/** @type {any} */
const getterStatus = await walletUtils.readLatestHead(
`published.wallet.${GETTER}`,
);
console.log('current: ', inspect(getterStatus, { depth: 10 }));
t.like(getterStatus, {
status: {
id: 'get-value',
},
updated: 'offerStatus',
});
t.false('result' in getterStatus.status, 'no result yet');
}
let getterStatus = await retryUntilCondition(
async () => walletUtils.readLatestHead(`published.wallet.${GETTER}`),
value => value.status.id === 'get-value' && value.updated === 'offerStatus',
'Offer get-value not succeeded',
{ setTimeout, retryIntervalMs: 5000, maxRetries: 15 },
);

console.log('current: ', inspect(getterStatus, { depth: 10 }));
t.like(getterStatus, {
status: {
id: 'get-value',
},
updated: 'offerStatus',
});
t.false('result' in getterStatus.status, 'no result yet');

t.log('restart valueVow');
await evalBundles(RESTART_VALUEVOW_DIR);
@@ -82,11 +82,7 @@ test('vow survives restart', async t => {
});

t.log('confirm the value is now in offer results');
{
const getterStatus = await walletUtils.readLatestHead(
`published.wallet.${GETTER}`,
);
getterStatus = await walletUtils.readLatestHead(`published.wallet.${GETTER}`);

t.like(getterStatus, { status: { result: offerArgs.value } });
}
t.like(getterStatus, { status: { result: offerArgs.value } });
});
37 changes: 24 additions & 13 deletions a3p-integration/proposals/z:acceptance/wallet.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* global fetch setTimeout */

import test from 'ava';
import '@endo/init';
import {
@@ -6,14 +8,21 @@ import {
GOV1ADDR,
GOV2ADDR,
CHAINID,
waitForBlock,
} from '@agoric/synthetic-chain';
import { $ } from 'execa';
import { execFileSync } from 'child_process';
import {
agd,
getBalances,
replaceTemplateValuesInFile,
} from './test-lib/utils.js';
import { retryUntilCondition } from './test-lib/sync-tools.js';
import { makeWalletUtils } from './test-lib/wallet.js';
import { networkConfig } from './test-lib/index.js';

const walletUtils = await makeWalletUtils(
{ setTimeout, execFileSync, fetch },
networkConfig,
);

test.serial(`send invitation via namesByAddress`, async t => {
const SUBMISSION_DIR = 'invitation-test-submission';
@@ -43,20 +52,23 @@ test.serial(`send invitation via namesByAddress`, async t => {
});

test.serial('exitOffer tool reclaims stuck payment', async t => {
const offerId = 'bad-invitation-15'; // offer submitted on proposal upgrade-15 with an incorrect method name
const from = 'gov1';

const before = await getBalances([GOV1ADDR], 'uist');
t.log('uist balance before:', before);
const istBalanceBefore = await getBalances([GOV1ADDR], 'uist');

await $`node ./exitOffer.js --id ${offerId} --from ${from} `;
await waitForBlock(2);
const offerId = 'bad-invitation-15'; // offer submitted on proposal upgrade-15 with an incorrect method name
await walletUtils.broadcastBridgeAction(GOV1ADDR, {
method: 'tryExitOffer',
offerId,
});

const after = await getBalances([GOV1ADDR], 'uist');
t.log('uist balance after:', after);
const istBalanceAfter = await retryUntilCondition(
async () => getBalances([GOV1ADDR], 'uist'),
istBalance => istBalance > istBalanceBefore,
'tryExitOffer failed to reclaim stuck payment ',
{ setTimeout, retryIntervalMs: 5000, maxRetries: 15 },
);

t.true(
after > before,
istBalanceAfter > istBalanceBefore,
'The IST balance should increase after reclaiming the stuck payment',
);
});
@@ -98,7 +110,6 @@ test.serial(`ante handler sends fee only to vbank/reserve`, async t => {
{ chainId: CHAINID, from: GOV1ADDR, yes: true },
);

await waitForBlock();
t.like(result, { code: 0 });

const [feeCollectorEndBalances, vbankReserveEndBalances] = await getBalances([
2 changes: 2 additions & 0 deletions packages/client-utils/test/exports.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/* eslint-disable import/no-extraneous-dependencies -- requiring the package itself to check exports map */
// @ts-check

import test from 'ava';

import * as index from '@agoric/client-utils';
1 change: 0 additions & 1 deletion packages/client-utils/test/snapshots/exports.test.js.md
Original file line number Diff line number Diff line change
@@ -13,7 +13,6 @@ Generated by [AVA](https://avajs.dev).
'makeAgoricNames',
'makeFromBoard',
'makeRpcUtils',
'makeTendermint34Client',
'makeVStorage',
'makeWalletUtils',
'pickEndpoint',