-
Notifications
You must be signed in to change notification settings - Fork 323
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
Stub: Create MockTendermint
#2771
Comments
Suggestion for Testnet 57: hold a design meeting and capture the requirements here. That's necessary for us to implement this meaningfully. We want better tests! And this ask is a core part of that push. There are external contributors we should engage to discuss spec here. |
Perhaps something like https://github.com/informalsystems/CometMock would be helpful. Let's take a spike and see if that tool works with our existing smoke test. |
Took a look at adding websocket support to TendermintProxy, because cometmock only supports websocket calls on its tm api service. With an assist from @plaidfinch, that refactor seems to have landed. However, it appears cometmock isn't able to communicate with our abci service; logs from tower-abci say:
So next I'll dig in over there to add more logging knobs and see if I can't sort out what about the abci is broken. |
This is a shot in the dark, but the tendermint socket protocol has changed between |
I have had time to peek at the code, and I have noticed two things: first, cometmock does in fact support JSONRPC over http (see: here). It also has a websocket endpoint, but that's also the case for cometbft, there's nothing special about this. The second, more important point, is that ABCI connections are performed using gRPC (see here) wherease Instead of making |
What's the downside to adding gRPC support to tower-abci? We could have a second Server implementation that translates Tonic-generated types into domain types and invokes the inner tower::Services, and wouldn't need to jump through the hoops the TSP server does to translate into requests/responses. We wouldn't have to wait on any upstream, and it would give us optionality to migrate to grpc communication with no significant changes to pd. |
That's a good idea, i suggested supporting TSP in cometmock because it looked the easiest since it would just require adding an option that calls the cometbft supplied TSP methods. Supporting gRPC in tower-abci sounds good though, but I think we would also need to switch over to gRPC from TSP in pd, so that it can communicate with Cometmock |
Ideally we should not switch over pd, but just instantiate the services in a test binary that uses the pd crate as a library. |
@hdevalence Note that since |
Submitted informalsystems/tendermint-rs#1338 for inclusion in |
Beautiful. Thanks for driving this forward, @erwanor. Now that we're waiting for upstream, is there any immediate progress we can make on this issue? I'm inclined to check with upstream weekly to encourage review, and in the meantime, switch to other tasks. Seems like a good time to make progress on #2263 so we're ready for 037 in the near future. |
@conorsch we need the server definitions to be merged into upstream before we can cut a release of In terms of progress that could be made here, sketching out what the integration testing with cometmock looks like is a big task. Henry mentioned having a dedicated binary that plugs into pd as a library. Maybe this is something @zbuc and you want to flesh out potentially. |
Fantastic! I'll try this and report back.
Sounds good, I've got some time with @zbuc next week and we'll discuss plans here together. |
Haven't made much headway on getting CometMock to work with our ABCI service, even with the addition of socket support. On the first connection over ABCI, receiving InitChain, our tower-abci service fails with The CometMock project is trying to maintain compatibility with both |
Met with the maintainer of CometMock today, who's going to take a look at our WIP branch and advise on comparable TSP support. We're optimistic we can unblock ABCI communication over sockets, which is the first step in our testing spike. Thereafter, we're eager to explore both the time-travel and forced-misbehavior APIs, which would unblock testing like #1209. However, I also learned that CM by default places every tx in its own block, disregarding the mempool, and ignoring CheckTx handlers. I'm not sure what the implications of that are for our testing needs, but we have a willing collaborator, and we'll tackle that challenge if and when it blocks us. |
The reason for the |
Providing some context here, so that we can close out this issue in favor of a newly specified ask. We spent some time with CometMock, which has a lot of nice features:
However, it also falls short of the original ask here:
Ideally, we want a solution that can be integration into |
Writing full integration tests is difficult, and our existing tests making use of
MockClient
(seeswap_and_swap_claim.rs
) are Not Great (they replicate pieces of application code within the test and do not actually execute the application behavior as it is executed in a real deployment).It would instead be better if we had a
MockTendermint
that kept track of some internal state and had the ability to execute a series of transactions via faked ABCI messages sent across some transport (calling against theApp::*
methods directly? A sidecar process calling via the local network?)More details/design to follow
The text was updated successfully, but these errors were encountered: