Add return type to (*RelayMsgs).Send() #667
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds a new return type indicating the accumulation of errors
encountered during message sending and the count of successful batches
sent. The return value is not yet used anywhere and existing behavior is
preserved so far.
There are two questionable existing behaviors:
On the first part of the batching, RelayMsgs.Success is &&-ed with
the newly received success, and when sending the "leftover" messages,
the Success field is overwritten to the final value. This means we
could report success if all early batches failed but only the last
batch to the destination chain succeeded.
I intend to address this in a following change by adding an
equivalent Success() method to the SendMsgsResult type which properly
reports if all sent batches succeeded.
I am not sure how this will differ from existing behavior in the
wild. I assume we will see more failures than before.
It is unclear to me, when there are multiple batches to be sent, and
one batch fails, is it safe to send a following batch, or should the
entire send operation abort? I don't yet have a thorough
understanding of what will be sent here to judge for myself which is
more appropriate.
/cc @jackzampolin and @jtieri for those behavior questions.