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 support: ibc bridge mocks for @agoric/orchestration #9572

Closed
0xpatrickdev opened this issue Jun 24, 2024 · 1 comment · Fixed by #9628
Closed

test support: ibc bridge mocks for @agoric/orchestration #9572

0xpatrickdev opened this issue Jun 24, 2024 · 1 comment · Fixed by #9628
Labels
enhancement New feature or request

Comments

@0xpatrickdev
Copy link
Member

What is the Problem Being Solved?

In unit testing flows for @agoric/orchestration, the EchoConectionKit is used to mock network / ibc:

const { portAllocator } = fakeNetworkEchoStuff(rootZone.subZone('network'));

const makeNetworkProtocol = prepareNetworkProtocol(zone, vowTools);
const makeEchoConnectionHandler = prepareEchoConnectionKit(zone);
const makeProtocolHandler = prepareProtocolHandler(
zone,
makeEchoConnectionHandler,
vowTools,
);
const protocol = makeNetworkProtocol(makeProtocolHandler());
const makePortAllocator = preparePortAllocator(zone, vowTools);
const portAllocator = makePortAllocator({ protocol });

This limits our ability to fully test contracts - we need to be able to simulate responses from a remote IBC Connection to see how a contract handles them.

In boot tests, we mocked some Bridge.DIBC events using responses for sim chains:

case BridgeId.DIBC:
switch (obj.type) {
case 'IBC_METHOD':
switch (obj.method) {
case 'startChannelOpenInit':
inbound(BridgeId.DIBC, icaMocks.channelOpenAck(obj));
return undefined;
case 'sendPacket':
switch (obj.packet.data) {
case protoMsgMocks.delegate.msg: {
return makeAckEvent(obj, protoMsgMocks.delegate.ack);
}
case protoMsgMocks.delegateWithOpts.msg: {
return makeAckEvent(
obj,
protoMsgMocks.delegateWithOpts.ack,
);
}
case protoMsgMocks.queryBalance.msg: {
return makeAckEvent(obj, protoMsgMocks.queryBalance.ack);
}
case protoMsgMocks.queryUnknownPath.msg: {
return makeAckEvent(
obj,
protoMsgMocks.queryUnknownPath.ack,
);
}
case protoMsgMocks.queryBalanceMulti.msg: {
return makeAckEvent(
obj,
protoMsgMocks.queryBalanceMulti.ack,
);
}
case protoMsgMocks.queryBalanceUnknownDenom.msg: {
return makeAckEvent(
obj,
protoMsgMocks.queryBalanceUnknownDenom.ack,
);
}
default: {
return makeAckEvent(obj, protoMsgMocks.error.ack);
}
}
default:
return undefined;
}
default:
return undefined;
}

Description of the Design

Provide a similar entry point for IBC mocks in @agoric/orchestration unit testing.

Security Considerations

Scaling Considerations

Test Plan

Upgrade Considerations

@0xpatrickdev 0xpatrickdev added the enhancement New feature or request label Jun 24, 2024
0xpatrickdev added a commit that referenced this issue Jun 24, 2024
- towards #9449
- deletes tests where paths are covered by other tests
- skips tests until functionality is tested elsewhere. see #9572 which blocks easily porting these to unit tests in @agoric/orchestration
0xpatrickdev added a commit that referenced this issue Jun 24, 2024
- towards #9449
- deletes tests where paths are covered by other tests
- skips tests until functionality is tested elsewhere. see #9572 which blocks easily porting these to unit tests in @agoric/orchestration
mergify bot added a commit that referenced this issue Jun 25, 2024
refs: #9449

## Description

Disables `@agoric/orchestration` tests in `packages/boot` that interact directly with Vows. _`EV` does not currently support vows, and these tests block efforts related to #9449._

For tests that are skipped and not deleted, I propose testing these paths after the completion of #9572. 

### Testing Considerations

Skips tests instead deleting them. Taking on some tech debt until #9572
@LuqiPan
Copy link
Contributor

LuqiPan commented Jun 25, 2024

This limits our ability to fully test contracts - we need to be able to simulate responses from a remote IBC Connection to see how a contract handles them.

What kinds of IBC messages do we need to simulate responses for?

In boot tests, we mocked some Bridge.DIBC events using responses for sim chains:

Could we reuse the code from boot test to simulate responses?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants