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

R4R: Tx Query return values #3642

Merged
merged 4 commits into from
Feb 15, 2019
Merged

R4R: Tx Query return values #3642

merged 4 commits into from
Feb 15, 2019

Conversation

jackzampolin
Copy link
Member

@jackzampolin jackzampolin changed the title Return 404 when tx not found and make query tx return output properly" R4R: Tx Query return values Feb 13, 2019
Copy link
Contributor

@alexanderbez alexanderbez left a comment

Choose a reason for hiding this comment

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

@jackzampolin did you test this locally? It fails CI on a nil pointer exception.

@alessio
Copy link
Contributor

alessio commented Feb 13, 2019

Do we have a cli test for this?

@jackzampolin jackzampolin changed the title R4R: Tx Query return values WIP: Tx Query return values Feb 13, 2019
@jackzampolin
Copy link
Member Author

Moving back to WIP pending fixed tests and added test coverage for this

@jackzampolin jackzampolin changed the title WIP: Tx Query return values R4R: Tx Query return values Feb 13, 2019
@codecov
Copy link

codecov bot commented Feb 13, 2019

Codecov Report

Merging #3642 into develop will decrease coverage by 0.04%.
The diff coverage is 60%.

@@             Coverage Diff             @@
##           develop    #3642      +/-   ##
===========================================
- Coverage    61.32%   61.27%   -0.05%     
===========================================
  Files          186      186              
  Lines        13998    14002       +4     
===========================================
- Hits          8584     8580       -4     
- Misses        4870     4878       +8     
  Partials       544      544

Copy link
Contributor

@cwgoes cwgoes left a comment

Choose a reason for hiding this comment

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

Needs PENDING.md, otherwise LGTM.

Copy link
Contributor

@alexanderbez alexanderbez left a comment

Choose a reason for hiding this comment

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

missing pending log entry, but otherwise LGTM 👍

@@ -26,18 +27,18 @@ func QueryTxCmd(cdc *codec.Codec) *cobra.Command {
Short: "Matches this txhash over all committed blocks",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
// find the key to look up the account
hashHexStr := args[0]
Copy link
Contributor

Choose a reason for hiding this comment

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

why delete?

Copy link
Member Author

Choose a reason for hiding this comment

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

Because it's only used in one place.

Copy link
Contributor

Choose a reason for hiding this comment

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

But it add meaning! Otherwise, you'd have to guess what it is

if err != nil {
return nil, err
}
if err = ValidateTxResult(cliCtx, res); !cliCtx.TrustNode && err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

This does not equal to what was before. Before we didn't execute ValidateTxResult if TrustNode == true.

Copy link
Member Author

Choose a reason for hiding this comment

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

good catch.

err = res.Proof.Validate(check.Header.DataHash)
if err != nil {
return err
if !cliCtx.TrustNode {
Copy link
Contributor

Choose a reason for hiding this comment

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

if cliCtx.TrustNode {
  return nil
}

Copy link
Member Author

Choose a reason for hiding this comment

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

this code does this. Slightly confused what you mean here? If we trust the node, we don't want to validate the results.

Copy link
Contributor

Choose a reason for hiding this comment

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

I meant instead of wrapping big chunk of code into if condition, you can return early!

Copy link
Contributor

@cwgoes cwgoes left a comment

Choose a reason for hiding this comment

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

ACK

@cwgoes cwgoes merged commit 5ccad47 into develop Feb 15, 2019
@cwgoes cwgoes deleted the jack/tx-not-found branch February 15, 2019 16:00
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.

5 participants