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

Fix SendMsgs, delete Send, and introduce GetMsgResult #106

Merged
merged 15 commits into from
Sep 23, 2023

Conversation

siburu
Copy link
Contributor

@siburu siburu commented Sep 12, 2023

No description provided.

@siburu siburu marked this pull request as ready for review September 12, 2023 19:00
@siburu siburu requested a review from a team as a code owner September 12, 2023 19:00
@siburu siburu requested a review from bluele September 13, 2023 02:25
Signed-off-by: Masanori Yoshida <[email protected]>
}

resTx, err := node.Tx(context.TODO(), txHash, false)
if err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we check if the node enables the transaction indexing like the following:
https://github.com/cosmos/relayer/blob/1bfe06cdec3bdd1e0ba64fafac2b6f39cf495e70/relayer/chains/cosmos/tx.go#L303

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If no checks, I think we should write a comment about this assumption.

core/send.go Outdated
// SendCheckMsgs is an utility function that executes `Chain::SendMsgs` and checks the execution results of all the messages.
func SendCheckMsgs(chain Chain, msgs []types.Msg) bool {
if _, err := chain.SendMsgs(msgs); err != nil {
GetChainLogger(chain).Error("failed to send msgs", err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like there is not msgs in error. Is this intended?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. I will add them.


// find tx
resTx, err := c.waitForCommit(msgID.txHash)
if err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. Even if resTx.TxResult.IsErr() == true, GetMsgResult returns (msgResult, nil).
At that case, msgResult.Status returns (false, failureReason).

if res.Code == 0 && c.msgEventListener != nil {

// wait for tx being committed
if resTx, err := c.waitForCommit(res.TxHash); err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is GetMsgResult not called here to avoid unnecessary log parsing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes!

…rns an unrecoverable error

Signed-off-by: Masanori Yoshida <[email protected]>
…x `GetFinalizedMsgResult` using this new function

Signed-off-by: Masanori Yoshida <[email protected]>
Signed-off-by: Masanori Yoshida <[email protected]>
@siburu siburu requested a review from bluele September 22, 2023 08:48
Copy link
Member

@bluele bluele left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks! LGTM👍

@bluele bluele merged commit c440f67 into hyperledger-labs:main Sep 23, 2023
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

Successfully merging this pull request may close these issues.

2 participants