diff --git a/a3p-integration/proposals/g:gtm-fast-usdc/package.json b/a3p-integration/proposals/g:gtm-fast-usdc/package.json index b305ca9ab53..7647c4796bd 100644 --- a/a3p-integration/proposals/g:gtm-fast-usdc/package.json +++ b/a3p-integration/proposals/g:gtm-fast-usdc/package.json @@ -11,7 +11,7 @@ "dependencies": { "@agoric/client-utils": "dev", "@agoric/fast-usdc": "dev", - "@agoric/synthetic-chain": "0.5.1", + "@agoric/synthetic-chain": "0.5.3", "@endo/init": "^1.1.8", "agoric": "dev", "ava": "^5.3.1" diff --git a/a3p-integration/proposals/g:gtm-fast-usdc/yarn.lock b/a3p-integration/proposals/g:gtm-fast-usdc/yarn.lock index 5c58946cf5b..14e274312fc 100644 --- a/a3p-integration/proposals/g:gtm-fast-usdc/yarn.lock +++ b/a3p-integration/proposals/g:gtm-fast-usdc/yarn.lock @@ -464,19 +464,20 @@ __metadata: languageName: node linkType: hard -"@agoric/synthetic-chain@npm:0.5.1": - version: 0.5.1 - resolution: "@agoric/synthetic-chain@npm:0.5.1" +"@agoric/synthetic-chain@npm:0.5.3": + version: 0.5.3 + resolution: "@agoric/synthetic-chain@npm:0.5.3" dependencies: - "@endo/zip": "npm:^1.0.7" - better-sqlite3: "npm:^11.8.0" + "@endo/zip": "npm:^1.0.9" + better-sqlite3: "npm:^11.8.1" chalk: "npm:^5.4.1" cosmjs-types: "npm:^0.9.0" execa: "npm:^9.5.2" - glob: "npm:^11.0.0" + glob: "npm:^11.0.1" + tmp: "npm:0.2.3" bin: synthetic-chain: dist/cli/cli.js - checksum: 10c0/38d796556a0940d124b750bcf82cbbbd9caee64031feeca4086350c4d05d68256e5b188d418354b511eeb1da0f95160205cc2701ae397bd86c304fc29850bc85 + checksum: 10c0/47e984c05a64fd520c1c7063b3f0a63d231f0da431bd169e0dece1cba5535696c3c582d32afc7771d869ecb6aa9f2945991c47e1ae015ba321d43a465e37573b languageName: node linkType: hard @@ -1264,7 +1265,7 @@ __metadata: languageName: node linkType: hard -"@endo/zip@npm:^1.0.7, @endo/zip@npm:^1.0.9": +"@endo/zip@npm:^1.0.9": version: 1.0.9 resolution: "@endo/zip@npm:1.0.9" checksum: 10c0/3fccea31bd5dad938a3b5f531454d3c49513892d6d5aba1f0af1034ff0ae54c3e28a346a9df08bd9e5201354acccd631e45c9c0e68fa2848a876a3919f3830dc @@ -1993,7 +1994,7 @@ __metadata: languageName: node linkType: hard -"better-sqlite3@npm:^11.8.0": +"better-sqlite3@npm:^11.8.1": version: 11.8.1 resolution: "better-sqlite3@npm:11.8.1" dependencies: @@ -3151,7 +3152,7 @@ __metadata: languageName: node linkType: hard -"glob@npm:^11.0.0": +"glob@npm:^11.0.1": version: 11.0.1 resolution: "glob@npm:11.0.1" dependencies: @@ -4796,7 +4797,7 @@ __metadata: dependencies: "@agoric/client-utils": "npm:dev" "@agoric/fast-usdc": "npm:dev" - "@agoric/synthetic-chain": "npm:0.5.1" + "@agoric/synthetic-chain": "npm:0.5.3" "@endo/init": "npm:^1.1.8" agoric: "npm:dev" ava: "npm:^5.3.1" @@ -5266,6 +5267,13 @@ __metadata: languageName: node linkType: hard +"tmp@npm:0.2.3, tmp@npm:^0.2.1": + version: 0.2.3 + resolution: "tmp@npm:0.2.3" + checksum: 10c0/3e809d9c2f46817475b452725c2aaa5d11985cf18d32a7a970ff25b568438e2c076c2e8609224feef3b7923fa9749b74428e3e634f6b8e520c534eef2fd24125 + languageName: node + linkType: hard + "tmp@npm:^0.0.33": version: 0.0.33 resolution: "tmp@npm:0.0.33" @@ -5275,13 +5283,6 @@ __metadata: languageName: node linkType: hard -"tmp@npm:^0.2.1": - version: 0.2.3 - resolution: "tmp@npm:0.2.3" - checksum: 10c0/3e809d9c2f46817475b452725c2aaa5d11985cf18d32a7a970ff25b568438e2c076c2e8609224feef3b7923fa9749b74428e3e634f6b8e520c534eef2fd24125 - languageName: node - linkType: hard - "to-regex-range@npm:^5.0.1": version: 5.0.1 resolution: "to-regex-range@npm:5.0.1" diff --git a/packages/orchestration/src/examples/send-anywhere.flows.js b/packages/orchestration/src/examples/send-anywhere.flows.js index 6022fcb40f1..58a216c96d3 100644 --- a/packages/orchestration/src/examples/send-anywhere.flows.js +++ b/packages/orchestration/src/examples/send-anywhere.flows.js @@ -44,6 +44,7 @@ export const sendIt = async ( assets.find(a => a.brand === amt.brand), `${amt.brand} not registered in vbank`, ); + debugger; const chain = await orch.getChain(chainName); const info = await chain.getChainInfo(); @@ -59,6 +60,7 @@ export const sendIt = async ( await localTransfer(seat, sharedLocalAccount, give); void log(`completed transfer to localAccount`); + console.log(`completed transfer to localAccount`); try { await sharedLocalAccount.transfer( @@ -69,6 +71,7 @@ export const sendIt = async ( }, { denom, value: amt.value }, ); + console.log(`completed transfer to ${destAddr}`); void log(`completed transfer to ${destAddr}`); } catch (e) { await withdrawToSeat(sharedLocalAccount, seat, give); diff --git a/packages/orchestration/src/examples/send-cctp.flows.js b/packages/orchestration/src/examples/send-cctp.flows.js index 6a8e2210ae3..06038b66bba 100644 --- a/packages/orchestration/src/examples/send-cctp.flows.js +++ b/packages/orchestration/src/examples/send-cctp.flows.js @@ -7,7 +7,7 @@ import { M, mustMatch } from '@endo/patterns'; * @import {Vow} from '@agoric/vow'; * @import {LocalOrchestrationAccountKit} from '../exos/local-orchestration-account.js'; * @import {ZoeTools} from '../utils/zoe-tools.js'; - * @import {Orchestrator, OrchestrationFlow, LocalAccountMethods, OrchestrationAccountCommon, OrchestrationAccount, IBCConnectionInfo, ChainAddress, ForwardInfo, Chain} from '../types.js'; + * @import {Orchestrator, OrchestrationFlow, LocalAccountMethods, OrchestrationAccountCommon, OrchestrationAccount, IBCConnectionInfo, AccountIdArg, ForwardInfo, Chain} from '../types.js'; * @import {IBCChannelID} from '@agoric/vats'; */ @@ -25,7 +25,6 @@ harden(makeNobleAccount); // TODO use case should be handled by `sendIt` based on the destination /** - * @deprecated `sendIt` should handle this * @satisfies {OrchestrationFlow} * @param {Orchestrator} orch * @param {object} ctx @@ -79,9 +78,14 @@ export const sendByCCTP = async ( const sharedLocalAccount = await sharedLocalAccountP; await localTransfer(seat, sharedLocalAccount, give); + debugger; + if (typeof info.cctpDestinationDomain !== 'number') { // within the inter-chain; no CCTP needed + console.log('CCTP via IBC'); try { + debugger; + await sharedLocalAccount.transfer( { value: destAddr, @@ -91,6 +95,7 @@ export const sendByCCTP = async ( { denom, value: amt.value }, ); void log(`completed transfer to ${destAddr}`); + console.log(`completed transfer to ${destAddr}`); } catch (e) { await withdrawToSeat(sharedLocalAccount, seat, give); const errorMsg = `IBC Transfer failed ${q(e)}`; @@ -98,24 +103,24 @@ export const sendByCCTP = async ( seat.exit(errorMsg); throw makeError(errorMsg); } - } - - console.log(`CCTP case: assume USDC`, amt.brand); + } else { + console.log(`CCTP case: assume USDC`, amt.brand); - const nobleAccount = await nobleAccountP; - const nobleAddr = await nobleAccount.getAddress(); - const denomAmt = { denom, value: amt.value }; - await sharedLocalAccount.transfer(nobleAddr, denomAmt); - console.log('assets are now on noble'); - - const encoding = 'ethereum'; // XXX TODO. could be solana? - /** @type {ChainAddress} */ - const mintRecipient = { chainId, encoding, value: destAddr }; - await nobleAccount.depositForBurn(mintRecipient, denomAmt); - console.log( - `transfer complete, we hope; could have FAILed between noble and dest, though`, - ); + debugger; + const nobleAccount = await nobleAccountP; + const nobleAddr = await nobleAccount.getAddress(); + const denomAmt = { denom, value: amt.value }; + await sharedLocalAccount.transfer(nobleAddr, denomAmt); + console.log('assets are now on noble'); + const encoding = 'ethereum'; // XXX TODO. could be solana? + /** @type {AccountIdArg} */ + const mintRecipient = { chainId, encoding, value: destAddr }; + await nobleAccount.depositForBurn(mintRecipient, denomAmt); + console.log( + `transfer complete, we hope; could have FAILed between noble and dest, though`, + ); + } seat.exit(); }; harden(sendByCCTP); diff --git a/packages/orchestration/src/exos/chain-hub.js b/packages/orchestration/src/exos/chain-hub.js index 461afdc159b..f9785ca8f65 100644 --- a/packages/orchestration/src/exos/chain-hub.js +++ b/packages/orchestration/src/exos/chain-hub.js @@ -6,7 +6,6 @@ import { BrandShape } from '@agoric/ertp/src/typeGuards.js'; import { VowShape } from '@agoric/vow'; import { CosmosChainAddressShape, - ChainInfoShape, CoinShape, CosmosChainInfoShape, DenomAmountShape, @@ -239,10 +238,10 @@ const ChainHubI = M.interface('ChainHub', { /** * Make a new ChainHub in the zone. * - * The resulting object is an Exo singleton. It has no precious state. It's only + * The resulting object is an Exo singleton. It has no precious state. Its only * state is a cache of queries to agoricNames and whatever info was provided in * registration calls. When you need a newer version you can simply make a hub - * hub and repeat the registrations. + * and repeat the registrations. * * @param {Zone} zone * @param {Remote} agoricNames diff --git a/packages/orchestration/src/exos/cosmos-orchestration-account.js b/packages/orchestration/src/exos/cosmos-orchestration-account.js index fabd2e2a9d4..76b445a8809 100644 --- a/packages/orchestration/src/exos/cosmos-orchestration-account.js +++ b/packages/orchestration/src/exos/cosmos-orchestration-account.js @@ -1021,6 +1021,7 @@ export const prepareCosmosOrchestrationAccountKit = ( }), ), ]); + debugger; return watch(results, this.facets.delegationQueryWatcher); }); }, diff --git a/packages/orchestration/src/exos/local-orchestration-account.js b/packages/orchestration/src/exos/local-orchestration-account.js index 8b00049fd5d..0bd1e389718 100644 --- a/packages/orchestration/src/exos/local-orchestration-account.js +++ b/packages/orchestration/src/exos/local-orchestration-account.js @@ -140,6 +140,7 @@ export const prepareLocalOrchestrationAccountKit = ( route: TransferRouteShape, }) .returns(Vow$(M.record())), + onRejected: M.call(M.error(), M.any()).returns(M.undefined()), }), extractFirstResultWatcher: M.interface('extractFirstResultWatcher', { onFulfilled: M.call([M.record()]) @@ -356,6 +357,8 @@ export const prepareLocalOrchestrationAccountKit = ( * }} ctx */ onFulfilled(timeoutTimestamp, { opts, route }) { + console.log('LOA tw', opts, route); + debugger; const { forwardInfo, ...transferDetails } = route; /** @type {string | undefined} */ let memo; @@ -390,6 +393,9 @@ export const prepareLocalOrchestrationAccountKit = ( // verified. return holder.sendThenWaitForAck(sender); }, + onRejected(reason, ...rest) { + console.log('LOA transferWatcher fail', { reason, rest }); + }, }, /** * takes an array of results (from `executeEncodedTx`) and returns the @@ -685,6 +691,7 @@ export const prepareLocalOrchestrationAccountKit = ( transfer(destination, amount, opts) { return asVow(() => { trace('Transferring funds over IBC'); + debugger; const denomAmount = coerceDenomAmount(chainHub, amount); diff --git a/packages/orchestration/src/exos/packet-tools.js b/packages/orchestration/src/exos/packet-tools.js index 2b873ebc2eb..adef684340a 100644 --- a/packages/orchestration/src/exos/packet-tools.js +++ b/packages/orchestration/src/exos/packet-tools.js @@ -231,6 +231,7 @@ export const preparePacketTools = (zone, vowTools) => { console.debug('Stashing object in upcallQueue'); this.state.upcallQueue = harden(upcallQueue.concat(obj)); } + debugger; console.debug('No match yet.'); }, }, @@ -289,6 +290,7 @@ export const preparePacketTools = (zone, vowTools) => { if (i < 0) { // No match yet. Save the pattern for later. console.debug('No match yet. Save the pattern for later.'); + console.log('No match', { pattern }); resolverToPattern.init(resolver, pattern); return; } diff --git a/packages/orchestration/test/examples/send-anywhere.test.ts b/packages/orchestration/test/examples/send-anywhere.test.ts index ec7b175679d..b017db04b50 100644 --- a/packages/orchestration/test/examples/send-anywhere.test.ts +++ b/packages/orchestration/test/examples/send-anywhere.test.ts @@ -65,7 +65,7 @@ test('single amount proposal shape (keyword record)', async t => { } }); -test('send using arbitrary chain info', async t => { +test.only('send using arbitrary chain info', async t => { t.log('bootstrap, orchestration core-eval'); const { bootstrap, @@ -119,6 +119,7 @@ test('send using arbitrary chain info', async t => { agoricToHotConnection, ); + console.log('SAt G'); t.log('client uses contract to send to hot new chain'); { const publicFacet = await E(zoe).getPublicFacet(sendKit.instance); @@ -126,16 +127,21 @@ test('send using arbitrary chain info', async t => { const amt = await E(zoe).getInvitationDetails(inv); t.is(amt.description, 'send'); + console.log('SAt H'); const anAmt = ist.units(3.5); const Send = await pourPayment(anAmt); + console.log('SAt H3'); const userSeat = await E(zoe).offer( inv, { give: { Send: anAmt } }, { Send }, { destAddr: 'hot1destAddr', chainName }, ); + console.log('SAt H5'); await transmitTransferAck(); + console.log('SAt H7'); await vt.when(E(userSeat).getOfferResult()); + console.log('SAt I'); const history = inspectLocalBridge(); t.like(history, [ @@ -146,6 +152,8 @@ test('send using arbitrary chain info', async t => { t.is(messages.length, 1); const [txfr] = messages; t.log('local bridge', txfr); + + console.log('SAt J'); t.like(txfr, { '@type': '/ibc.applications.transfer.v1.MsgTransfer', receiver: 'hot1destAddr', @@ -156,6 +164,7 @@ test('send using arbitrary chain info', async t => { }); } + console.log('SAt K'); t.log('well-known chains such as cosmos work the same way'); { const anAmt = ist.units(1.25); diff --git a/packages/orchestration/test/exos/cosmos-orchestration-account.test.ts b/packages/orchestration/test/exos/cosmos-orchestration-account.test.ts index 550f0e1e3b6..a812cb9c45a 100644 --- a/packages/orchestration/test/exos/cosmos-orchestration-account.test.ts +++ b/packages/orchestration/test/exos/cosmos-orchestration-account.test.ts @@ -526,7 +526,7 @@ test('getBalance and getBalances', async t => { } }); -test('StakingAccountQueries', async t => { +test.only('StakingAccountQueries', async t => { const { mocks: { ibcBridge }, } = t.context; @@ -775,6 +775,7 @@ test('StakingAccountQueries', async t => { }; // Test getDelegation + debugger; const delegationResult = await E(account).getDelegation(mockValidator); t.deepEqual(delegationResult, { amount: { denom: 'uatom', value: 1000000n }, diff --git a/packages/orchestration/test/network-fakes.ts b/packages/orchestration/test/network-fakes.ts index 6dba6c9dd84..0da76749396 100644 --- a/packages/orchestration/test/network-fakes.ts +++ b/packages/orchestration/test/network-fakes.ts @@ -268,6 +268,7 @@ export const makeFakeIBCBridge = ( trace('Could not decode packet data', err); } } + debugger; const ackEvent = ibcBridgeMocks.acknowledgementPacket(obj, { sequence: ibcSequenceNonce, acknowledgement: mockAckMapHasData @@ -286,6 +287,7 @@ export const makeFakeIBCBridge = ( return undefined; }, fromBridge: async obj => { + debugger; trace('fromBridge', obj); bridgeEvents = bridgeEvents.concat(obj); if (!bridgeHandler) throw Error('no handler!'); diff --git a/packages/orchestration/test/supports.ts b/packages/orchestration/test/supports.ts index 67c118635f9..4fde872aeb1 100644 --- a/packages/orchestration/test/supports.ts +++ b/packages/orchestration/test/supports.ts @@ -151,6 +151,8 @@ export const commonSetup = async (t: ExecutionContext) => { ibcSequenceNonce += 1n; // let the promise for the transfer start await eventLoopIteration(); + debugger; + if (localBridgeMessages.length < 1) throw Error('no messages on the local bridge'); @@ -159,15 +161,15 @@ export const commonSetup = async (t: ExecutionContext) => { throw Error('no messages in the last tx'); const lastMsgTransfer = b1.messages[0]; - await E(transferBridge).fromBridge( - buildVTransferEvent({ - receiver: lastMsgTransfer.receiver, - sender: lastMsgTransfer.sender, - target: lastMsgTransfer.sender, - sourceChannel: lastMsgTransfer.sourceChannel, - sequence: ibcSequenceNonce, - }), - ); + const event = buildVTransferEvent({ + receiver: lastMsgTransfer.receiver, + sender: lastMsgTransfer.sender, + target: lastMsgTransfer.sender, + sourceChannel: lastMsgTransfer.sourceChannel, + sequence: ibcSequenceNonce, + }); + debugger; + await E(transferBridge).fromBridge(event); // let the bridge handler finish await eventLoopIteration(); }; diff --git a/packages/vats/src/bridge-target.js b/packages/vats/src/bridge-target.js index 3674a03f362..ce32499d394 100644 --- a/packages/vats/src/bridge-target.js +++ b/packages/vats/src/bridge-target.js @@ -188,6 +188,7 @@ export const prepareBridgeTargetKit = (zone, makeTargetRegistration) => { bridgeHandler: { fromBridge(obj) { + debugger; const { inboundEventType, targetToApp } = this.state; const { type, target } = obj; diff --git a/packages/vats/src/transfer.js b/packages/vats/src/transfer.js index 2e75ebc8540..6cb407f7fea 100644 --- a/packages/vats/src/transfer.js +++ b/packages/vats/src/transfer.js @@ -81,6 +81,11 @@ const prepareTransferInterceptor = (zone, vowTools) => { ); // Upon failure, respond with an error acknowledgement. retP = watch(retP, this.facets.nackSender, { response }); + } else { + console.log( + 'TransferInterceptor received unknown packet, ignoring', + obj.event, + ); } // Always log errors. diff --git a/packages/vats/tools/fake-bridge.js b/packages/vats/tools/fake-bridge.js index 067d5dc724f..e9220f7c190 100644 --- a/packages/vats/tools/fake-bridge.js +++ b/packages/vats/tools/fake-bridge.js @@ -376,6 +376,8 @@ export const makeFakeTransferBridge = (zone, onToBridge = () => {}) => { return undefined; }, fromBridge: async obj => { + debugger; + console.log('FakeTBridge', obj); if (!hndlr) throw Error('no handler!'); return when(E(hndlr).fromBridge(obj)); },