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

Support for converting IBCEvent into abci::Event #81

Closed
5 tasks done
adizere opened this issue Apr 20, 2021 · 5 comments
Closed
5 tasks done

Support for converting IBCEvent into abci::Event #81

adizere opened this issue Apr 20, 2021 · 5 comments
Assignees

Comments

@adizere
Copy link
Contributor

adizere commented Apr 20, 2021

Crate

ibc

Summary

Currently, there is no way to transform an IbcEvent into the corresponding tendermint::abci::Event.

Context

Why do we need this feature?

This feature is necessary for being able to test integration of the ibc crate against Hermes. More concretely, for this kind of test, the complete path of execution is as follows:

  1. relayer calls send_msgs to submit a batch of transactions to a chain, and expects as a response a Vec<IbcEvent>:

https://github.com/informalsystems/ibc-rs/blob/d5ba86d182a8cc488f3dd500408bdde320db11be/relayer/src/chain.rs#L108

  1. the chain processes these transactions by calling into our ibc modules, which produce IbcEvent types upon delivering a set of transactions.

  2. the ABCI interface of a Tendermint chain should produce abci::Event types (not IbcEvent). The present issue covers this step of translating IbcEvent into abci::Event.

  3. the chain responds to the relayer with a vector of abci::Event. The relayer then translates these into IbcEvent which it can continue processing.

Question

Notice that there is a redundant step in the execution above: produce IbcEvent (step 2), translate into abci::Event (step 3), translate back into IbcEvent (step 4). It is not clear if we can avoid this double conversion.

Acceptance Criteria

There are two parts to this issue:

  1. clarify if we can avoid the double conversion problem.
  2. if we cannot avoid the redundancy in conversion, then add a method
pub fn from_event(e: &IbcEvent) -> Option<tendermint::abci::Event>

probably somewhere in ics02_client/events.rs.


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate milestone (priority) applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@ancazamfir
Copy link
Collaborator

Found this while looking at informalsystems/hermes#1375. What is the concrete usecase for converting IBC events into abci events?

@adizere
Copy link
Contributor Author

adizere commented Sep 27, 2021

I think the idea is to make an ibc-rs chain (e.g., basecoin-rs) capable of generating events out of executed transactions, so that it can send these events to Hermes (via websocket). Then we can have an integration test that covers the entire feedback loop between basecoin-rs and Hermes, allowing to test the start command.

@ancazamfir
Copy link
Collaborator

So basecoin-rs chain generates the transactions? In what format are the transaction events?

@hu55a1n1
Copy link
Contributor

basecoin-rs (upon receipt of hermes tx raw {create-client | update-client}) calls into the IBC routing module's dispatch() which generates IBCEvents:
https://github.com/informalsystems/basecoin-rs/blob/phase3/src/app/modules/ibc.rs#L438-L445

And here's the code that converts these events to ABCI Events that can be returned to tendermint:
https://github.com/informalsystems/basecoin-rs/blob/phase3/src/app/modules/ibc.rs#L477-L501

@romac romac changed the title Support for converting IBCEvent into abci::Event Support for converting IBCEvent into abci::Event Sep 28, 2021
@yito88
Copy link
Contributor

yito88 commented Oct 6, 2021

I didn't know this issue before trying my implementation!
I have added the conversion for IbcEvent to abci::Event at informalsystems/hermes#1430.

I'd like to add this conversion so that a chain can emit an IBC event including specified attributes for each event.

@hu55a1n1 hu55a1n1 transferred this issue from informalsystems/hermes Sep 29, 2022
livelybug pushed a commit to octopus-network/ibc-rs that referenced this issue Oct 14, 2022
shuoer86 pushed a commit to shuoer86/ibc-rs that referenced this issue Nov 4, 2023
Bumps [github.com/gogo/protobuf](https://github.com/gogo/protobuf) from 1.3.1 to 1.3.2.
- [Release notes](https://github.com/gogo/protobuf/releases)
- [Commits](gogo/protobuf@v1.3.1...v1.3.2)

---
updated-dependencies:
- dependency-name: github.com/gogo/protobuf
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants