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

test(fast-usdc): count computrons for advancement #10621

Merged
merged 3 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/boot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"build": "exit 0",
"clean": "rm -rf bundles/config.*",
"test": "ava",
"test:xs": "SWINGSET_WORKER_TYPE=xs-worker ava test/bootstrapTests test/upgrading",
"test:xs": "SWINGSET_WORKER_TYPE=xs-worker ava test/bootstrapTests test/upgrading test/fast-usdc",
"lint-fix": "yarn lint:eslint --fix",
"lint": "run-s --continue-on-error lint:*",
"lint:types": "tsc",
Expand Down
45 changes: 38 additions & 7 deletions packages/boot/test/fast-usdc/fast-usdc.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { test as anyTest } from '@agoric/zoe/tools/prepare-test-env-ava.js';

import type { TestFn } from 'ava';
import type { FastUSDCKit } from '@agoric/fast-usdc/src/fast-usdc.start.js';
import type { CctpTxEvidence } from '@agoric/fast-usdc/src/types.js';
import { MockCctpTxEvidences } from '@agoric/fast-usdc/test/fixtures.js';
import { documentStorageSchema } from '@agoric/governance/tools/storageDoc.js';
import { Fail } from '@endo/errors';
Expand All @@ -14,12 +12,34 @@ import {
makeWalletFactoryContext,
type WalletFactoryTestContext,
} from '../bootstrapTests/walletFactory.js';
import {
makeSwingsetHarness,
insistManagerType,
} from '../../tools/supports.js';

const test: TestFn<
WalletFactoryTestContext & {
harness?: ReturnType<typeof makeSwingsetHarness>;
}
> = anyTest;

const test: TestFn<WalletFactoryTestContext> = anyTest;
const {
SLOGFILE: slogFile,
SWINGSET_WORKER_TYPE: defaultManagerType = 'local',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was expecting this to get set to xsnap somewhere in ci, but I don't see it.

I'm not certain where the bar should be. hm.

} = process.env;

test.before('bootstrap', async t => {
const config = '@agoric/vm-config/decentral-itest-orchestration-config.json';
t.context = await makeWalletFactoryContext(t, config);
insistManagerType(defaultManagerType);
const harness = ['xs-worker', 'xsnap'].includes(defaultManagerType)
? makeSwingsetHarness()
: undefined;
const ctx = await makeWalletFactoryContext(t, config, {
slogFile,
defaultManagerType,
harness,
});
t.context = { ...ctx, harness };
});
test.after.always(t => t.context.shutdown?.());

Expand Down Expand Up @@ -129,7 +149,12 @@ test.serial('writes fee config to vstorage', async t => {
});

test.serial('makes usdc advance', async t => {
const { walletFactoryDriver: wd, storage, agoricNamesRemotes } = t.context;
const {
walletFactoryDriver: wd,
storage,
agoricNamesRemotes,
harness,
} = t.context;
const oracles = await Promise.all([
wd.provideSmartWallet('agoric19uscwxdac6cf6z7d5e26e0jm0lgwstc47cpll8'),
wd.provideSmartWallet('agoric1krunjcqfrf7la48zrvdfeeqtls5r00ep68mzkr'),
Expand Down Expand Up @@ -167,7 +192,8 @@ test.serial('makes usdc advance', async t => {
await eventLoopIteration();

const evidence = MockCctpTxEvidences.AGORIC_PLUS_OSMO();
// TODO - start counting computrons

harness?.useRunPolicy(true);
await Promise.all(
oracles.map(wallet =>
wallet.sendOffer({
Expand All @@ -183,7 +209,12 @@ test.serial('makes usdc advance', async t => {
),
);
await eventLoopIteration();
// TODO - stop counting computrons
harness &&
t.log(
`fusdc advance computrons (${oracles.length} oracles)`,
harness.totalComputronCount(),
);
harness?.resetRunPolicy();

const doc = {
node: `fastUsdc.status`,
Expand Down
Loading