Skip to content

Commit

Permalink
chore: bridge supports unique address per ICA
Browse files Browse the repository at this point in the history
  • Loading branch information
0xpatrickdev committed Dec 5, 2024
1 parent 0569f82 commit be4b63b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
24 changes: 11 additions & 13 deletions packages/boot/test/bootstrapTests/orchestration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -378,19 +378,19 @@ test.serial('basic-flows', async t => {
[
'request-coa',
{
account: 'published.basicFlows.cosmos1test',
account: 'published.basicFlows.cosmos1test1',
},
],
],
});
t.like(wd.getLatestUpdateRecord(), {
status: { id: 'request-coa', numWantsSatisfied: 1 },
});
t.deepEqual(readPublished('basicFlows.cosmos1test'), {
t.deepEqual(readPublished('basicFlows.cosmos1test1'), {
localAddress:
'/ibc-port/icacontroller-2/ordered/{"version":"ics27-1","controllerConnectionId":"connection-8","hostConnectionId":"connection-649","address":"cosmos1test","encoding":"proto3","txType":"sdk_multi_msg"}/ibc-channel/channel-2',
'/ibc-port/icacontroller-2/ordered/{"version":"ics27-1","controllerConnectionId":"connection-8","hostConnectionId":"connection-649","address":"cosmos1test1","encoding":"proto3","txType":"sdk_multi_msg"}/ibc-channel/channel-2',
remoteAddress:
'/ibc-hop/connection-8/ibc-port/icahost/ordered/{"version":"ics27-1","controllerConnectionId":"connection-8","hostConnectionId":"connection-649","address":"cosmos1test","encoding":"proto3","txType":"sdk_multi_msg"}/ibc-channel/channel-2',
'/ibc-hop/connection-8/ibc-port/icahost/ordered/{"version":"ics27-1","controllerConnectionId":"connection-8","hostConnectionId":"connection-649","address":"cosmos1test1","encoding":"proto3","txType":"sdk_multi_msg"}/ibc-channel/channel-2',
});

// create a local orchestration account
Expand Down Expand Up @@ -599,25 +599,23 @@ test.serial('basic-flows - portfolio holder', async t => {
'request-portfolio-acct',
{
agoric: 'published.basicFlows.agoric1fakeLCAAddress1',
cosmoshub: 'published.basicFlows.cosmos1test',
// XXX support multiple chain addresses in ibc mocks
osmosis: 'published.basicFlows.cosmos1test',
cosmoshub: 'published.basicFlows.cosmos1test2',
osmosis: 'published.basicFlows.cosmos1test3',
},
],
],
});
t.like(wd.getLatestUpdateRecord(), {
status: { id: 'request-portfolio-acct', numWantsSatisfied: 1 },
});
// XXX this overrides a previous account, since mocks only provide one address
t.deepEqual(readPublished('basicFlows.cosmos1test'), {

t.deepEqual(readPublished('basicFlows.cosmos1test3'), {
localAddress:
'/ibc-port/icacontroller-4/ordered/{"version":"ics27-1","controllerConnectionId":"connection-1","hostConnectionId":"connection-1649","address":"cosmos1test","encoding":"proto3","txType":"sdk_multi_msg"}/ibc-channel/channel-4',
'/ibc-port/icacontroller-4/ordered/{"version":"ics27-1","controllerConnectionId":"connection-1","hostConnectionId":"connection-1649","address":"cosmos1test3","encoding":"proto3","txType":"sdk_multi_msg"}/ibc-channel/channel-4',
remoteAddress:
'/ibc-hop/connection-1/ibc-port/icahost/ordered/{"version":"ics27-1","controllerConnectionId":"connection-1","hostConnectionId":"connection-1649","address":"cosmos1test","encoding":"proto3","txType":"sdk_multi_msg"}/ibc-channel/channel-4',
'/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',
});
// XXX this overrides a previous account, since mocks only provide one address
t.is(readPublished('basicFlows.agoric1fakeLCAAddress'), '');
t.is(readPublished('basicFlows.agoric1fakeLCAAddress1'), '');

const { BLD } = agoricNamesRemotes.brand;
BLD || Fail`BLD missing from agoricNames`;
Expand Down
8 changes: 7 additions & 1 deletion packages/boot/tools/ibc/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ export const protoMsgMocks = {
msg: 'eyJ0eXBlIjoxLCJkYXRhIjoiQ25zS0tTOXBZbU11WVhCd2JHbGpZWFJwYjI1ekxuUnlZVzV6Wm1WeUxuWXhMazF6WjFSeVlXNXpabVZ5RWs0S0NIUnlZVzV6Wm1WeUVndGphR0Z1Ym1Wc0xUVXpOaG9UQ2cxcFltTXZkWFZ6WkdOb1lYTm9FZ0l4TUNJTFkyOXpiVzl6TVhSbGMzUXFDbTV2WW14bE1YUmxjM1F5QURpQThKTEwzUWc9IiwibWVtbyI6IiJ9',
ack: responses.ibcTransfer,
},
// MsgTransfer 10 ibc/uusdchash from cosmos1test1 to noble1test through channel-536
ibcTransfer2: {
msg: 'eyJ0eXBlIjoxLCJkYXRhIjoiQ253S0tTOXBZbU11WVhCd2JHbGpZWFJwYjI1ekxuUnlZVzV6Wm1WeUxuWXhMazF6WjFSeVlXNXpabVZ5RWs4S0NIUnlZVzV6Wm1WeUVndGphR0Z1Ym1Wc0xUVXpOaG9UQ2cxcFltTXZkWFZ6WkdOb1lYTm9FZ0l4TUNJTVkyOXpiVzl6TVhSbGMzUXhLZ3B1YjJKc1pURjBaWE4wTWdBNGdQQ1N5OTBJIiwibWVtbyI6IiJ9',
ack: responses.ibcTransfer,
},
error: {
msg: '',
ack: responses.error5,
Expand Down Expand Up @@ -127,7 +132,8 @@ export const icaMocks = {
channel_id: mockRemoteChannelID,
},
counterpartyVersion: addParamsIfJsonVersion(obj.version, {
address: `${bech32Prefix}1test`,
// mockID expected to increase monotonically since icacontroller ports are sequential
address: `${bech32Prefix}1test${mocklID < 2 ? '' : mocklID - 1}`,
}),
connectionHops: obj.hops,
order: obj.order,
Expand Down

0 comments on commit be4b63b

Please sign in to comment.