Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(boot): simulate incoming vtransfer bridge events #10132

Merged
merged 3 commits into from
Sep 25, 2024

Conversation

0xpatrickdev
Copy link
Member

@0xpatrickdev 0xpatrickdev commented Sep 24, 2024

closes: #10131

Description

Security Considerations

n/a

Scaling Considerations

n/a

Documentation Considerations

n/a

Testing Considerations

Addreses a test.failing checked in

Upgrade Considerations

n/a, example contract and test support tools

Copy link

cloudflare-workers-and-pages bot commented Sep 24, 2024

Deploying agoric-sdk with  Cloudflare Pages  Cloudflare Pages

Latest commit: 7508618
Status: ✅  Deploy successful!
Preview URL: https://baf1cebc.agoric-sdk.pages.dev
Branch Preview URL: https://10131-vtransfer-boot.agoric-sdk.pages.dev

View logs

Comment on lines -73 to -74
t.is(await flushInboundQueue(), 0);
t.deepEqual(wallet.getLatestUpdateRecord(), beforeFlush);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why remove these assurances?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are not sending or recieving any DIBC bridge messages in send-anywhere, so flushing the queue (which only has DIBC messages) seemed unnecessary

Comment on lines 623 to 632
async inboundVTransferEvent(params: BuildVTransferEventParams) {
await runUtils.queueAndRun(
() => inbound(BridgeId.VTRANSFER, buildVTransferEvent(params)),
true,
);
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this strikes me as too high level for bridgeUtils. The name also doesn't convey how it's different from simply inbound(BridgeId.VTRANSFER, buildVTransferEvent(params)),

WDYT of,

Suggested change
async inboundVTransferEvent(params: BuildVTransferEventParams) {
await runUtils.queueAndRun(
() => inbound(BridgeId.VTRANSFER, buildVTransferEvent(params)),
true,
);
},
async runInbound(...args: Parameters<typeof inbound>>) {
await runUtils.queueAndRun(
() => inbound(...args),
true,
);
},

If we want better autocomplete we could improve the underlying inbound type to look at the first arg to narrow the rest.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, Parameters<typeof inbound> is just ...any[], so I narrowed to ask for BridgeId for the first argument.

Comment on lines 83 to 86
await inboundVTransferEvent({
sourceChannel: 'channel-5',
sequence: '1',
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is too abstract for BridgeUtils. (see comment below)

Putting a suggestion here to see how it looks:

Suggested change
await inboundVTransferEvent({
sourceChannel: 'channel-5',
sequence: '1',
});
await runInbound(BridgeId.VTRANSFER, buildVTransferEvent({
sourceChannel: 'channel-5',
sequence: '1',
});

(and drop the export for BuildVTransferEventParams)

If that's too clunky, ibc-mocks.ts could have a helper like,

const makeRunIbcTransfer = (queueInbound) => 
  (event: Parameters<typeof buildVTransferEvent>[0]) => queueInbound(BridgeId.VTRANSFER, buildVTransferEvent(event);

and this could be,

Suggested change
await inboundVTransferEvent({
sourceChannel: 'channel-5',
sequence: '1',
});
await runIbcTransfer({
sourceChannel: 'channel-5',
sequence: '1',
});

@0xpatrickdev 0xpatrickdev added the automerge:rebase Automatically rebase updates, then merge label Sep 25, 2024
@mergify mergify bot merged commit 7d15388 into master Sep 25, 2024
80 checks passed
@mergify mergify bot deleted the 10131-vtransfer-boot branch September 25, 2024 04:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge:rebase Automatically rebase updates, then merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

boot test: support simulating incoming vtransfer bridge events
2 participants