Skip to content

Commit 0da8968

Browse files
committed
WIP: perf: block height, time details
1 parent ec93fe2 commit 0da8968

File tree

1 file changed

+32
-5
lines changed

1 file changed

+32
-5
lines changed

multichain-testing/test/fast-usdc/fast-usdc.test.ts

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import anyTest from '@endo/ses-ava/prepare-endo.js';
22

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

105108
return {
106109
...common,
110+
api,
107111
lpUser,
108112
feeUser,
109113
oracleWds,
@@ -210,6 +214,7 @@ const advanceAndSettleScenario = test.macro({
210214
`advance ${mintAmt} uusdc to ${eudChain} and settle`,
211215
exec: async (t, mintAmt: bigint, eudChain: string) => {
212216
const {
217+
api,
213218
nobleTools,
214219
nobleAgoricChannelId,
215220
txOracles,
@@ -267,10 +272,22 @@ const advanceAndSettleScenario = test.macro({
267272
});
268273

269274
log('User initiates EVM burn:', evidence.txHash);
275+
const { block } = await queryBlock(api);
270276
console.time(`UX->${eudChain}`);
277+
console.timeLog(
278+
`UX->${eudChain}`,
279+
'initial height',
280+
block.header.height,
281+
block.header.time,
282+
);
271283

272284
// submit evidences
273-
await Promise.all(txOracles.map(o => o.submit(evidence)));
285+
await Promise.all(
286+
txOracles.map(async o => {
287+
const { block } = await o.submit(evidence);
288+
console.timeLog(`UX->${eudChain}`, o.getName(), block);
289+
}),
290+
);
274291
console.timeLog(`UX->${eudChain}`, 'submitted x', txOracles.length);
275292

276293
const queryClient = makeQueryClient(
@@ -280,12 +297,22 @@ const advanceAndSettleScenario = test.macro({
280297
await t.notThrowsAsync(async () => {
281298
const q = await retryUntilCondition(
282299
() => queryClient.queryBalance(EUD, usdcOnOsmosis),
283-
({ balance }) => !!balance?.amount && BigInt(balance.amount) < mintAmt,
300+
({ balance }) =>
301+
!!balance?.amount &&
302+
BigInt(balance.amount) > 0n &&
303+
BigInt(balance.amount) < mintAmt,
284304
`${EUD} advance available from fast-usdc`,
285305
// this resolves quickly, so _decrease_ the interval so the timing is more apparent
286-
{ retryIntervalMs: 500 },
306+
{ retryIntervalMs: 500, maxRetries: 12 },
307+
);
308+
console.timeLog(`UX->${eudChain}`, 'rxd', q.balance?.amount);
309+
const { block } = await queryBlock(api);
310+
console.timeLog(
311+
`UX->${eudChain}`,
312+
'final block',
313+
block.header.height,
314+
block.header.time,
287315
);
288-
console.timeLog(`UX->${eudChain}`, 'rxd', q.balance);
289316
});
290317
console.timeEnd(`UX->${eudChain}`);
291318

0 commit comments

Comments
 (0)