From b8cbd928b0c3e65222bb22b5e3fa4c85d8309e3e Mon Sep 17 00:00:00 2001 From: 0xPatrick Date: Tue, 17 Dec 2024 17:43:04 -0500 Subject: [PATCH] chore: mock `VLOCALCHAIN_ALLOCATE_ADDRESS` handler returns valid bech32 - instead of `agoric1fakeLCAAddress`, `agoric1fakeLCAAddress1` - to support `encodeAddressHook` which relies on valid bech32 --- .../test/bootstrapTests/orchestration.test.ts | 14 +++++++++++--- .../fast-usdc/snapshots/fast-usdc.test.ts.md | 8 ++++---- .../snapshots/fast-usdc.test.ts.snap | Bin 2209 -> 2218 bytes .../orchestration/contract-upgrade.test.ts | 3 +++ .../orchestration/restart-contracts.test.ts | 3 +++ packages/boot/tools/supports.ts | 3 ++- 6 files changed, 23 insertions(+), 8 deletions(-) diff --git a/packages/boot/test/bootstrapTests/orchestration.test.ts b/packages/boot/test/bootstrapTests/orchestration.test.ts index 0de187aa734..ae79ea51687 100644 --- a/packages/boot/test/bootstrapTests/orchestration.test.ts +++ b/packages/boot/test/bootstrapTests/orchestration.test.ts @@ -16,6 +16,7 @@ import { SIMULATED_ERRORS } from '@agoric/vats/tools/fake-bridge.js'; import fetchedChainInfo from '@agoric/orchestration/src/fetched-chain-info.js'; import { buildVTransferEvent } from '@agoric/orchestration/tools/ibc-mocks.js'; import { BridgeId } from '@agoric/internal'; +import { makeTestAddress } from '@agoric/orchestration/tools/make-test-address.js'; import { makeWalletFactoryContext, type WalletFactoryTestContext, @@ -410,8 +411,9 @@ test.serial('basic-flows', async t => { const publicSubscriberPaths = Object.fromEntries( wd.getCurrentWalletRecord().offerToPublicSubscriberPaths, ); + const expectedAddress = makeTestAddress(); t.deepEqual(publicSubscriberPaths['request-loa'], { - account: 'published.basicFlows.agoric1fakeLCAAddress', + account: `published.basicFlows.${expectedAddress}`, }); t.like(wd.getLatestUpdateRecord(), { status: { id: 'request-loa', numWantsSatisfied: 1 }, @@ -487,6 +489,8 @@ test.serial('basic-flows', async t => { await runInbound( BridgeId.VTRANSFER, buildVTransferEvent({ + receiver: expectedAddress, + target: expectedAddress, sourceChannel: 'channel-62', sequence: '1', }), @@ -598,7 +602,8 @@ test.serial('basic-flows - portfolio holder', async t => { [ 'request-portfolio-acct', { - agoric: 'published.basicFlows.agoric1fakeLCAAddress1', + agoric: + 'published.basicFlows.agoric1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqc09z0g', cosmoshub: 'published.basicFlows.cosmos1test2', osmosis: 'published.basicFlows.cosmos1test3', }, @@ -615,7 +620,10 @@ test.serial('basic-flows - portfolio holder', async t => { remoteAddress: '/ibc-hop/connection-1/ibc-port/icahost/ordered/{"version":"ics27-1","controllerConnectionId":"connection-1","hostConnectionId":"connection-1649","address":"cosmos1test3","encoding":"proto3","txType":"sdk_multi_msg"}/ibc-channel/channel-4', }); - t.is(readPublished('basicFlows.agoric1fakeLCAAddress1'), ''); + t.is( + readPublished('basicFlows.agoric1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqc09z0g'), + '', + ); const { BLD } = agoricNamesRemotes.brand; BLD || Fail`BLD missing from agoricNames`; diff --git a/packages/boot/test/fast-usdc/snapshots/fast-usdc.test.ts.md b/packages/boot/test/fast-usdc/snapshots/fast-usdc.test.ts.md index eae055ef42a..ace588bbdf2 100644 --- a/packages/boot/test/fast-usdc/snapshots/fast-usdc.test.ts.md +++ b/packages/boot/test/fast-usdc/snapshots/fast-usdc.test.ts.md @@ -132,19 +132,19 @@ Generated by [AVA](https://avajs.dev). [ 'published.fastUsdc', { - poolAccount: 'agoric1fakeLCAAddress', - settlementAccount: 'agoric1fakeLCAAddress1', + poolAccount: 'agoric1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqp7zqht', + settlementAccount: 'agoric1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqc09z0g', }, ], [ - 'published.fastUsdc.agoric1fakeLCAAddress', + 'published.fastUsdc.agoric1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqp7zqht', { body: '#""', slots: [], }, ], [ - 'published.fastUsdc.agoric1fakeLCAAddress1', + 'published.fastUsdc.agoric1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqc09z0g', { body: '#""', slots: [], diff --git a/packages/boot/test/fast-usdc/snapshots/fast-usdc.test.ts.snap b/packages/boot/test/fast-usdc/snapshots/fast-usdc.test.ts.snap index c837074b0fac8a8353a3bc2e4a0b8b6253eecf4f..0098b4788bfb2c84ca53df4b055872bf5e179aab 100644 GIT binary patch literal 2218 zcmV;b2vzq%RzV*U(0|lC_oI+c4zVrHGpD#tIjxPyO zX&Q1#D%yiE-W}VUTkkl#dPMTn$9h)NYgJRpI1Kq@@&PXej}1*8^G zC3vAi0;)K&lb$r ztBhHClRLJ#tqZPi_=0=1#%$lEO~1~CfAzX$Q9(bhysTmZ!H1-XG6x_B-~dU^l0?b# z=r$ppr~Ui)gG_=DkSRhw)NxW7fOP<0h&d{8M+Iar4iE)*5EUdbOYUm6Dvs^fnKfUf zzBun&=6q238CkeYb0bJXf;`$U0Q?%jTL2bFJ6H1I$|YtBqIMr=W@bR95v15h$T@;; zx@ogcZC3`jnGdo*D5hh)!{rr+m1^9x&2pW(E^|&<9pj`Kwq$Zf%xzk_t?&l5-8Nn$ znjFk41h^WnQ|qgf$U2{k)R`)I6ZLzpD!I*q>Pqx zg(6!#vJ{Jcr)i4jIlj)^hnVj(x5m8w*v9hWV%9RUE6ZiGxRf_?Mv>8K-Z)+?7V|6F ze6esOcRX7x#bQs$DeDZZ`i&cikH5*?s_iwXu(|8E$6sL%tuSZnU*}zmd3w70nx*G- zQD=I3z}uGAU2ZYm_H~OntQL$_uyO);jk(ODj!s=mm-S@)CNu4-ZH7zC4i+5uB=!XL zg?@f@r7V}={N%Yh)7chnG##c_n8P=9+i_aH@My410}tP-Sz1T&K+@qu#~)<~yWt*A6M@a=2>4 zIYIl~E#rh|#^!|g4d#ThtXpPzzDo&-R{;DLz}o<32#^^~3z}SR4@Q>TUX#1Rqoz1Z z1(Vi|h*hgPRL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5d z9jd&((3N;sb;1SwUsvV2`m)aS`LdE-6gk$-rCqjN18ln^wx$$sk(Y*P@j(4uDVpu; zqxlKbG|jVIvSVf+Ui)aXkqfph!XIJ%G!76?omH<|7-ftUehvJ)$N&th)45HWxK6j?9J5b1f;KTXW_7 zRnc7T{jk>vYIKbWvmqSYq|SPHXzSfrklZ~x(cT&PMEi7~_a`@fF`wSF^H#~uS?O#k zm!_G;qxO=WO;g)i%3C>BvYl);XE}?xoKw!1%8MnIT`rdw^Gn%mW+`Var86qWKXgvR zT9N>JhM#;%jHbtgq_WYuvENl#xm-9~Jbm`D){gZbLwBs { await runInbound( BridgeId.VTRANSFER, buildVTransferEvent({ + sender: makeTestAddress(), + target: makeTestAddress(), sourceChannel: 'channel-5', sequence: '1', }), diff --git a/packages/boot/test/orchestration/restart-contracts.test.ts b/packages/boot/test/orchestration/restart-contracts.test.ts index b727b8a74be..bf5d22efd07 100644 --- a/packages/boot/test/orchestration/restart-contracts.test.ts +++ b/packages/boot/test/orchestration/restart-contracts.test.ts @@ -10,6 +10,7 @@ import { import { buildVTransferEvent } from '@agoric/orchestration/tools/ibc-mocks.js'; import type { UpdateRecord } from '@agoric/smart-wallet/src/smartWallet.js'; import fetchedChainInfo from '@agoric/orchestration/src/fetched-chain-info.js'; +import { makeTestAddress } from '@agoric/orchestration/tools/make-test-address.js'; import { makeWalletFactoryContext, type WalletFactoryTestContext, @@ -101,6 +102,8 @@ test.serial('send-anywhere', async t => { await runInbound( BridgeId.VTRANSFER, buildVTransferEvent({ + sender: makeTestAddress(), + target: makeTestAddress(), sourceChannel: 'channel-5', sequence: '1', }), diff --git a/packages/boot/tools/supports.ts b/packages/boot/tools/supports.ts index 77e1cdc61ca..8f17cb2be16 100644 --- a/packages/boot/tools/supports.ts +++ b/packages/boot/tools/supports.ts @@ -7,6 +7,7 @@ import { resolve as importMetaResolve } from 'import-meta-resolve'; import { basename, join } from 'path'; import { inspect } from 'util'; +import { makeTestAddress } from '@agoric/orchestration/tools/make-test-address.js'; import { buildSwingset } from '@agoric/cosmic-swingset/src/launch-chain.js'; import type { TypedPublished } from '@agoric/client-utils'; import { @@ -538,7 +539,7 @@ export const makeSwingsetTestKit = async ( return undefined; } case `${BridgeId.VLOCALCHAIN}:VLOCALCHAIN_ALLOCATE_ADDRESS`: { - const address = `${LOCALCHAIN_DEFAULT_ADDRESS}${lcaAccountsCreated || ''}`; + const address = makeTestAddress(lcaAccountsCreated); lcaAccountsCreated += 1; return address; }