Skip to content

Commit

Permalink
WIP: perf: block height, time details
Browse files Browse the repository at this point in the history
  • Loading branch information
dckc committed Jan 17, 2025
1 parent ec93fe2 commit 0da8968
Showing 1 changed file with 32 additions and 5 deletions.
37 changes: 32 additions & 5 deletions multichain-testing/test/fast-usdc/fast-usdc.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import anyTest from '@endo/ses-ava/prepare-endo.js';

import { makeBlocksIterable } from '@agoric/client-utils/src/chain.js';
import {
makeBlocksIterable,
queryBlock,
} from '@agoric/client-utils/src/chain.js';
import { makeAPI } from '@agoric/client-utils/src/grpc-rest-api.js';
import { encodeAddressHook } from '@agoric/cosmic-proto/address-hooks.js';
import type { QueryBalanceResponseSDKType } from '@agoric/cosmic-proto/cosmos/bank/v1beta1/query.js';
Expand Down Expand Up @@ -104,6 +107,7 @@ const makeTestContext = async t => {

return {
...common,
api,
lpUser,
feeUser,
oracleWds,
Expand Down Expand Up @@ -210,6 +214,7 @@ const advanceAndSettleScenario = test.macro({
`advance ${mintAmt} uusdc to ${eudChain} and settle`,
exec: async (t, mintAmt: bigint, eudChain: string) => {
const {
api,
nobleTools,
nobleAgoricChannelId,
txOracles,
Expand Down Expand Up @@ -267,10 +272,22 @@ const advanceAndSettleScenario = test.macro({
});

log('User initiates EVM burn:', evidence.txHash);
const { block } = await queryBlock(api);
console.time(`UX->${eudChain}`);
console.timeLog(
`UX->${eudChain}`,
'initial height',
block.header.height,
block.header.time,
);

// submit evidences
await Promise.all(txOracles.map(o => o.submit(evidence)));
await Promise.all(
txOracles.map(async o => {
const { block } = await o.submit(evidence);
console.timeLog(`UX->${eudChain}`, o.getName(), block);
}),
);
console.timeLog(`UX->${eudChain}`, 'submitted x', txOracles.length);

const queryClient = makeQueryClient(
Expand All @@ -280,12 +297,22 @@ const advanceAndSettleScenario = test.macro({
await t.notThrowsAsync(async () => {
const q = await retryUntilCondition(
() => queryClient.queryBalance(EUD, usdcOnOsmosis),
({ balance }) => !!balance?.amount && BigInt(balance.amount) < mintAmt,
({ balance }) =>
!!balance?.amount &&
BigInt(balance.amount) > 0n &&
BigInt(balance.amount) < mintAmt,
`${EUD} advance available from fast-usdc`,
// this resolves quickly, so _decrease_ the interval so the timing is more apparent
{ retryIntervalMs: 500 },
{ retryIntervalMs: 500, maxRetries: 12 },
);
console.timeLog(`UX->${eudChain}`, 'rxd', q.balance?.amount);
const { block } = await queryBlock(api);
console.timeLog(
`UX->${eudChain}`,
'final block',
block.header.height,
block.header.time,
);
console.timeLog(`UX->${eudChain}`, 'rxd', q.balance);
});
console.timeEnd(`UX->${eudChain}`);

Expand Down

0 comments on commit 0da8968

Please sign in to comment.