From 4698c1c63a99b0c2fc487f2146e01b03fe23d5b9 Mon Sep 17 00:00:00 2001 From: 0xPatrick Date: Mon, 23 Sep 2024 20:14:50 -0400 Subject: [PATCH] test: send-anywhere settled offer --- .../orchestration/restart-contracts.test.ts | 60 +++++++++---------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/packages/boot/test/orchestration/restart-contracts.test.ts b/packages/boot/test/orchestration/restart-contracts.test.ts index 25e7d881268c..9c2bc5ab264b 100644 --- a/packages/boot/test/orchestration/restart-contracts.test.ts +++ b/packages/boot/test/orchestration/restart-contracts.test.ts @@ -18,14 +18,13 @@ test.before(async t => { }); test.after.always(t => t.context.shutdown?.()); -// FIXME the test needs to be able to send the acknowledgementPacket ack -// so that the transfer vow resolves. -test.serial.failing('send-anywhere', async t => { +// TODO #9303 execute restart-send-anywhere.js proposal +test.serial('send-anywhere', async t => { const { walletFactoryDriver, buildProposal, evalProposal, - bridgeUtils: { flushInboundQueue }, + bridgeUtils: { inboundVTransferEvent }, } = t.context; const { IST } = t.context.agoricNamesRemotes.brand; @@ -57,43 +56,44 @@ test.serial.failing('send-anywhere', async t => { chainName: 'cosmoshub', }, }); - // no errors and no resolution - const beforeFlush = wallet.getLatestUpdateRecord(); - t.like(wallet.getLatestUpdateRecord(), { - updated: 'offerStatus', - status: { - id: 'send-somewhere', - error: undefined, - }, - numWantsSatisfied: undefined, - payouts: undefined, - result: undefined, - }); - t.is(await flushInboundQueue(), 0); - t.deepEqual(wallet.getLatestUpdateRecord(), beforeFlush); + t.like( + wallet.getCurrentWalletRecord(), + { liveOffers: [['send-somewhere']] }, + 'live offer until we simulate the transfer ack', + ); + + // TODO #9303 Error#1: replay 12: ["checkCall","[Alleged: contractState guest wrapper]","get",["localAccount"],12] vs ["doReturn",11,"[undefined]"] : length: unequal 5 vs 3 + // t.log('restart send-anywhere'); + // await evalProposal( + // buildProposal('@agoric/builders/scripts/testing/restart-send-anywhere.js'), + // ); - t.log('restart send-anywhere'); - await evalProposal( - buildProposal('@agoric/builders/scripts/testing/restart-send-anywhere.js'), + t.like( + wallet.getLatestUpdateRecord(), + { + updated: 'balance', + currentAmount: { value: [] }, + }, + 'no offerStatus updates', ); + // simulate ibc/MsgTransfer ack from remote chain, enabling `.transfer()` promise + // to resolve + await inboundVTransferEvent({ + sourceChannel: 'channel-5', + sequence: '1', + }); + const conclusion = wallet.getLatestUpdateRecord(); - console.log('conclusion', conclusion); t.like(conclusion, { updated: 'offerStatus', status: { - id: 'send-somewhere', + numWantsSatisfied: 1, error: undefined, + result: undefined, }, - numWantsSatisfied: undefined, - payouts: undefined, - result: undefined, }); - - await flushInboundQueue(); - - // Nothing interesting to confirm here. }); const validatorAddress: CosmosValidatorAddress = {