Skip to content

Commit

Permalink
chore: mock VLOCALCHAIN_ALLOCATE_ADDRESS handler returns valid bech32
Browse files Browse the repository at this point in the history
- instead of `agoric1fakeLCAAddress`, `agoric1fakeLCAAddress1`
- to support `encodeAddressHook` which relies on valid bech32
  • Loading branch information
0xpatrickdev committed Dec 18, 2024
1 parent 71dc3b0 commit b8cbd92
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 8 deletions.
14 changes: 11 additions & 3 deletions packages/boot/test/bootstrapTests/orchestration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 },
Expand Down Expand Up @@ -487,6 +489,8 @@ test.serial('basic-flows', async t => {
await runInbound(
BridgeId.VTRANSFER,
buildVTransferEvent({
receiver: expectedAddress,
target: expectedAddress,
sourceChannel: 'channel-62',
sequence: '1',
}),
Expand Down Expand Up @@ -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',
},
Expand All @@ -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`;
Expand Down
8 changes: 4 additions & 4 deletions packages/boot/test/fast-usdc/snapshots/fast-usdc.test.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: [],
Expand Down
Binary file modified packages/boot/test/fast-usdc/snapshots/fast-usdc.test.ts.snap
Binary file not shown.
3 changes: 3 additions & 0 deletions packages/boot/test/orchestration/contract-upgrade.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { BridgeId } from '@agoric/internal';
import { buildVTransferEvent } from '@agoric/orchestration/tools/ibc-mocks.js';
import fetchedChainInfo from '@agoric/orchestration/src/fetched-chain-info.js';
import { withChainCapabilities } from '@agoric/orchestration';
import { makeTestAddress } from '@agoric/orchestration/tools/make-test-address.js';
import {
makeWalletFactoryContext,
type WalletFactoryTestContext,
Expand Down Expand Up @@ -100,6 +101,8 @@ test('resume', async t => {
await runInbound(
BridgeId.VTRANSFER,
buildVTransferEvent({
sender: makeTestAddress(),
target: makeTestAddress(),
sourceChannel: 'channel-5',
sequence: '1',
}),
Expand Down
3 changes: 3 additions & 0 deletions packages/boot/test/orchestration/restart-contracts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -101,6 +102,8 @@ test.serial('send-anywhere', async t => {
await runInbound(
BridgeId.VTRANSFER,
buildVTransferEvent({
sender: makeTestAddress(),
target: makeTestAddress(),
sourceChannel: 'channel-5',
sequence: '1',
}),
Expand Down
3 changes: 2 additions & 1 deletion packages/boot/tools/supports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit b8cbd92

Please sign in to comment.