-
Notifications
You must be signed in to change notification settings - Fork 332
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
Wait for tx hash to succeed regardless of unrecognized IbcEvents #2303
Conversation
Is there an issue we can link here that describes the usecase of "unsuported" transactions? If not, can we open one and provide some context? |
@@ -36,20 +36,15 @@ pub async fn send_batched_messages_and_wait_commit( | |||
) | |||
.await?; | |||
|
|||
wait_for_block_commits( | |||
let events = wait_for_block_commits( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original intent for send_batched_messages_and_wait_commit()
was:
- send
N
messages to the chain - get back exactly
N
IbcEvent
-s such that resulti
is for messagei
Not sure this still holds. For non-IBC messages we could get IbcEvent::Empty
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand the rationale to expect the number of IbcEvent
s to be exactly the same as the number of messages sent. In theory one message can result in any number of chain events, which can be translated into any number of IbcEvent
s.
I think a more practical approach is to use find
through the result list of IbcEvent
s to find the event of interest, instead of looking at a specific position.
Also the change does not affect the semantics of existing transactions sent. So if the existing code produce messages that result in exact number of IbcEvent
s, then they would still get that. It would only affect future changes, such as when the code is updated to send non-IBC messages mixed with IBC messages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand the rationale to expect the number of
IbcEvent
s to be exactly the same as the number of messages sent. In theory one message can result in any number of chain events, which can be translated into any number ofIbcEvent
s.
It's always been the case in practice that an IBC message results in one and only one IBC event. While the events have not been documented in the IBC spec yet, some documentation exists here
I think a more practical approach is to use
find
through the result list ofIbcEvent
s to find the event of interest, instead of looking at a specific position.
You still need to figure out the original message that caused a specific IbcEvent
. But sure there are other ways of coding this. Still trying to understand the usecase that breaks the current design.
Also the change does not affect the semantics of existing transactions sent. So if the existing code produce messages that result in exact number of
IbcEvent
s, then they would still get that.
Yes I was asking in general not necessarily pointing to your changes in this PR.
It would only affect future changes, such as when the code is updated to send non-IBC messages mixed with IBC messages.
Yeah, i still want to understand this. I think hermes should only deal with IBC messages and never send messages that have nothing to do with IBC. Probably we should start with what "IBC message" means? And what is a non-IBC message?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original intent for
send_batched_messages_and_wait_commit()
was:
- send
N
messages to the chain- get back exactly
N
IbcEvent
-s such that resulti
is for messagei
Not sure this still holds. For non-IBC messages we could get
IbcEvent::Empty
i checked master and it is broken. When a Tx has N messages, if the Tx fails then all messages should be marked as failed and get back N error events. I have a quick fix in branch anca/err_for_all_msgs_in_tx
. Also added and corrected some comments.
I haven't checked/ fixed the packet worker (async sender), at first look it doesn't handle error events here: (https://github.com/informalsystems/ibc-rs/blob/194a1714cf9dc807dd7b4e33726319293848dc58/relayer/src/link/relay_path.rs#L609-L615).
For the sync sender cases the code looks better.
Filed #2314. |
.iter() | ||
.map(|tx_hash| wait_tx_hash(rpc_client, rpc_address, timeout, tx_hash)) | ||
.collect::<FuturesOrdered<_>>() | ||
.try_collect() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the purpose of this try_collect
? Is it attempting to resolve the Futures in the previous collect
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@seanchen1991 I believe the first collect
populates the FuturesOrdered
with tasks to complete, and try_collect
is a futures
method to drive the stream and collect the yielded values, failing fast on error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can see from Rust Analyzer the types for each step:
let responses = tx_hashes
// Iterator of `Hash`
.iter()
// Iterator of future of `Result<TxSearchResponse, Error>`
.map(|tx_hash| wait_tx_hash(rpc_client, rpc_address, timeout, tx_hash))
// Future of iterator of `Result<TxSearchResponse, Error>`
.collect::<FuturesOrdered<_>>()
// Future of `Result<Vec<TxSearchResponse>, Error>`
.try_collect()
.await?;
- Basically we have a collection that in simple form is something like
Vec<Future<Result<TxSearchResponse, Error>>>
. - But we want to return
Result<Vec<TxSearchResponse>, Error>
. - So we first turn it into
Future<Vec<Result<TxSearchResponse, Error>>>
using.collect::<FuturesOrdered<_>>()
. - Next we turn it into a
Future<Result<Vec<TxSearchResponse>, Error>>
using.try_collect()
. - Finaly we turn it into
Result<Vec<TxSearchResponse>, Error>
using.await
.
I think SDK upgrade proposals are one example of non-IBC transactions. I doubt there will be others. @mzabaluev had experience with parsing events from non-IBC tx-es, specifically while working with upgrade proposals in #1909; we closed the PR because it required too many changes: #1909 (comment). We decide in that PR that Hermes will not wait on tx events after submitting the upgrade proposal, and instead it just prints the tx hash and exits (solution is #1979). |
As far as I understand, the A discussion on how to systematize chain events should go hand in hand with broader extensibility, which looks like a sane way to accommodate non-Cosmos chains: #2284 (comment) |
Yes but part of that message is this blob defined in IBC TAO (client) implementation. And imo if it is defined in the IBC TAO proto, implemented (even partially) by an IBC core (client in this case) handler then it is a transaction that should generate and IBC event. |
I agree with the approach of digging into the particular use-cases of where we need to support non-IBC events. What are those cases in detail?
|
I will close this PR because it is a distraction from doing a stable v1 release. SummaryThe discussion here & in the associated issue can be summarised as follows: It is unclear what benefits or problem we're solving by allowing non-IBC events to percolate through the Hermes pipeline. Further detailsThere are 2 cases where non-IBC events could have been potentially interesting for Hermes:
For the above two cases, it makes sense to have IBC events associated with them, and the IBC-go team agreed to fix that. Other cases which will demand non-IBC events might occur in the future, and in that case we could reconsider the relayer architecture. Quoted the issue #2314:
Hermes is indeed specialized to IBC transactions. That could change in the future to become a more general off-chain orchestrator, but not clear at this point. Until concrete cases such as the above appear & inform our architectural decisions, I don't see a reason to generalize the relayer beyond IBC. There is another implicit specialization (or assumption) that Hermes makes when submits transactions: it expects each message to result in one IBC event by filtering the |
Closes: #2314
Description
Extracted from #2227 to make the waiting of send_tx to succeed if all TxHash are committed successfully. Previously, send_tx would timeout and fail if unsupported transactions are submitted with events unrecognized by
IbcEvent
, even if the transaction were successful.PR author checklist:
unclog
.docs/
).Reviewer checklist:
Files changed
in the GitHub PR explorer.