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

Complete IBC Mock testing #255

Closed
ethanfrey opened this issue Aug 19, 2020 · 2 comments
Closed

Complete IBC Mock testing #255

ethanfrey opened this issue Aug 19, 2020 · 2 comments
Labels

Comments

@ethanfrey
Copy link
Member

This builds on what is done in #253 and adds some simpler demos as defined in our milestone:

Add a mockHandler that plays ping-pong:

  • version is "ping" or "pong" (both acceptable)
  • on version negotiation the "Try" side will switch the version (if "ping" requested, counterparty does "pong" and visa versa)
  • stores a counter in state (starts at 0)
  • Packets are JSON, only valid ones look like {"ping": 5}
  • Receiver will add the value to the local state and return acknowledgement
  • Acknowledgement is either {"error": "message here"} or {"success": {"pong": 14}} or whatever the updated state is
  • On receiving acknowledgement, if a success, then that "remoteState" is stored. If error, increment "numErrors"

This handler has "localState" and "remoteState". Receiving a "ping" packet will increment "localState". Getting a "pong" acknowlegdement will set "remoteState".

Once this is build, a few scenarios:

  • Proper connection (show version is swapped from original request), sending packets with coordinators, it works well
  • Send {"random": "data"} packet and verify we get an "error" acknowledgement back (numErrors == 1)
  • Try connecting with invalid version (transfer) and show channel will not get established
@alpe
Copy link
Member

alpe commented Aug 21, 2020

on version negotiation the "Try" side will switch the version (if "ping" requested, counterparty does "pong" and visa versa)

I may not got it correct but what I can see in the code is that the Try side can only accept what is sent to it. So either success or error is returned. The relayer sends the version. There are no negotiation rules defined in IBC where the "Try" side can propose something new. It can be custom logic in the relayer though

@ethanfrey
Copy link
Member Author

ethanfrey commented Aug 21, 2020

From our IBC Spec:

The counterparty has a chance for version negotiation in OnChanOpenTry, where the contract can apply custom logic. It provides the protocol versions that the initiating party expects, and the contract can reject the connection or accept it and return the protocol version it will communicate with. Implementing this (contract selects a version, not just the relayer) requires that we support ADR 025. TODO: check with Agoric and cwgoes to upstream any Cosmos SDK changes so this can work out of the box.

Necessary changes are documented in ADR025

This section in particular we should be able to change in the x/wasm/module.go file. If it does not have the desired request, we can make an issue on cosmos-sdk to support the ADR. (I assume it was approved as it was merged to master)

@alpe alpe closed this as completed Nov 20, 2020
zemyblue pushed a commit to Finschia/wasmd that referenced this issue Jan 2, 2023
…ster

* remotes/gaia/master: (38 commits)
  Merge PR CosmWasm#259: Bump SDK master commit
  Exec go mod tidy (CosmWasm#267)
  Merge PR CosmWasm#265: add version v2.0.5 to CHANGELOG
  Fix broken link in delegator guide (CosmWasm#262)
  docs: removed redundant readme.md (CosmWasm#261)
  Merge PR CosmWasm#258: Bump github.com/spf13/viper from 1.6.1 to 1.6.2
  Merge PR CosmWasm#250: Docs-update
  Merge PR CosmWasm#256: Bump github.com/pkg/errors from 0.9.0 to 0.9.1
  Merge PR CosmWasm#255: Bump github.com/pkg/errors from 0.8.1 to 0.9.0
  Merge PR CosmWasm#253: Bump SDK master commit
  Merge PR CosmWasm#252: v2.0.4 Changelog
  Merge PR CosmWasm#249: docker image build and upload for release tags
  Merge PR CosmWasm#247: Update SDK Commit & Update CLI Doc
  Merge PR CosmWasm#246: Update Archive page with explorers
  Merge PR CosmWasm#245: archives
  Bump SDK commit to the latest master (CosmWasm#239)
  Merge PR CosmWasm#215: Update simulation tests
  Update join-mainnet.md (CosmWasm#229)
  Incorporate SDK's latest changes (CosmWasm#227)
  Merge PR CosmWasm#221: Hide unnecessarily exported function to better coverage report
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants