Skip to content

Commit

Permalink
test(fast-usdc): count computrons for advancement
Browse files Browse the repository at this point in the history
  • Loading branch information
samsiegart committed Dec 4, 2024
1 parent d6a7ffb commit 28ca0bc
Showing 1 changed file with 37 additions and 5 deletions.
42 changes: 37 additions & 5 deletions packages/boot/test/fast-usdc/fast-usdc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,33 @@ 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',
} = 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 =
defaultManagerType === 'xsnap' ? 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 +150,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 +193,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 +210,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

0 comments on commit 28ca0bc

Please sign in to comment.