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

feat: add event-query-tx-for cmd to subscribe and wait for transaction #17274

Merged
merged 14 commits into from
Aug 17, 2023

Conversation

mmsqe
Copy link
Contributor

@mmsqe mmsqe commented Aug 3, 2023

Description

allow client wait for transaction by hash after block mode is removed in #12659


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • run make lint and make test
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

@mmsqe mmsqe force-pushed the event-query-tx-for branch from e5c9776 to e98849e Compare August 3, 2023 12:57
@mmsqe mmsqe marked this pull request as ready for review August 3, 2023 12:57
@mmsqe mmsqe requested a review from a team as a code owner August 3, 2023 12:57
@github-prbot github-prbot requested review from a team, tac0turtle and julienrbrt and removed request for a team August 3, 2023 12:59
if err != nil {
return err
}
c, err := rpchttp.New(clientCtx.NodeURI, "/websocket")
Copy link
Member

Choose a reason for hiding this comment

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

This is tightly coupled to CometBFT, maybe we should say something about that in Use or Short. Ideally the client shouldn't make too many assumptions about the server implementation, but when it's a unavoidable let's at least make them clear.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated, see if it's ok

@julienrbrt julienrbrt self-assigned this Aug 7, 2023
}

// QueryEventForTxCmd returns a CLI command that subscribes to a WebSocket connection and waits for a transaction event with the given hash.
func QueryEventForTxCmd() *cobra.Command {
Copy link
Member

Choose a reason for hiding this comment

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

Can we add this command in simapp?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks, added

Copy link
Member

@julienrbrt julienrbrt left a comment

Choose a reason for hiding this comment

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

lgtm! However, imho this should not be in auth.
Can we move it somewhere else?

@github-actions github-actions bot added C:x/tx and removed C:x/auth labels Aug 14, 2023
@mmsqe
Copy link
Contributor Author

mmsqe commented Aug 14, 2023

lgtm! However, imho this should not be in auth.
Can we move it somewhere else?

Move under client/rpc/tx, see if it's ok

@github-actions github-actions bot removed the C:x/tx label Aug 14, 2023
@julienrbrt
Copy link
Member

lgtm! However, imho this should not be in auth.
Can we move it somewhere else?

Move under client/rpc/tx, see if it's ok

Makes indeed more sense, thanks!

Copy link
Member

@julienrbrt julienrbrt left a comment

Choose a reason for hiding this comment

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

tACK. One nit.

client/rpc/tx.go Outdated
return clientCtx.PrintProto(newResponseFormatBroadcastTxCommit(res))
}
case <-ctx.Done():
return errors.ErrLogic.Wrapf("timed out waiting for event")
Copy link
Member

Choose a reason for hiding this comment

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

I would be more clear here, the transaction could have already been included or wasn't yet included.

@julienrbrt julienrbrt added the backport/v0.47.x PR scheduled for inclusion in the v0.47's next stable release label Aug 16, 2023
@julienrbrt julienrbrt added the backport/v0.50.x PR scheduled for inclusion in the v0.50's next stable release label Aug 16, 2023
client/rpc/tx.go Outdated
return clientCtx.PrintProto(newResponseFormatBroadcastTxCommit(res))
}
case <-ctx.Done():
return errors.ErrLogic.Wrapf("the transaction could have already been included or wasn't yet included")
Copy link
Member

Choose a reason for hiding this comment

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

I think we should still keep the timeout message you had, just be more precise.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sorry, I copied from the comment shamelessly

@julienrbrt julienrbrt mentioned this pull request Aug 16, 2023
20 tasks
@julienrbrt julienrbrt added this pull request to the merge queue Aug 17, 2023
Merged via the queue into cosmos:main with commit d0f2344 Aug 17, 2023
mergify bot pushed a commit that referenced this pull request Aug 17, 2023
mergify bot pushed a commit that referenced this pull request Aug 17, 2023
#17274)

(cherry picked from commit d0f2344)

# Conflicts:
#	CHANGELOG.md
#	simapp/simd/cmd/commands.go
julienrbrt pushed a commit that referenced this pull request Aug 17, 2023
…n (backport #17274) (#17434)

Co-authored-by: mmsqe <mavis@crypto.com>
tac0turtle added a commit that referenced this pull request Aug 18, 2023
…n (backport #17274) (#17435)

Co-authored-by: mmsqe <mavis@crypto.com>
Co-authored-by: Julien Robert <julien@rbrt.fr>
Co-authored-by: marbar3778 <marbar3778@yahoo.com>
@faddat faddat mentioned this pull request Nov 8, 2024
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/v0.47.x PR scheduled for inclusion in the v0.47's next stable release backport/v0.50.x PR scheduled for inclusion in the v0.50's next stable release C:CLI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants