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 fetch txs by height on legacy REST endpoint #7730

Merged
merged 11 commits into from
Nov 2, 2020
Merged

Conversation

amaury1093
Copy link
Contributor

@amaury1093 amaury1093 commented Oct 29, 2020

Description

closes #7721


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against correct branch (see CONTRIBUTING.md)
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the module structure standards.
  • Wrote unit and integration tests
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/)
  • Added relevant godoc comments.
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer
  • Review Codecov Report in the comment section below once CI passes

return
}

if output.Empty() {
rest.WriteErrorResponse(w, http.StatusNotFound, fmt.Sprintf("no transaction found with hash %s", hashHexStr))
}

rest.PostProcessResponseBare(w, clientCtx, stdTx)
rest.PostProcessResponseBare(w, clientCtx, output)
Copy link
Contributor Author

@amaury1093 amaury1093 Oct 29, 2020

Choose a reason for hiding this comment

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

This happens on the query tx by hash endpoint. On master: we output a StdTx. In this PR, I changed to output a TxResponse.

This is a breaking change compared to master, but it's actually the same output as 0.39. I think TxResponse is better here.

s.Require().True(strings.Contains(string(txJSON), stdTx.Memo))

// We now fetch the tx on `/txs` route, filtering by `height`
txJSON, err = rest.GetRequest(fmt.Sprintf("%s/txs?height=%d", val0.APIAddress, txRes.Height))
Copy link
Contributor Author

@amaury1093 amaury1093 Oct 29, 2020

Choose a reason for hiding this comment

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

Anyone knows why we can have both the ?height= and the ?tx.height= query params?

?tx.height (posted by Zaki initially) now works correctly. However, ?height returns 0 result, but maybe it means something else?

Test fails because I'm not sure what it's actually supposed to do.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed testing ?height for now. I am not sure if ?height=n is supposed to:

  • set the clientCtx height to n
  • query events with attribute height=n
  • or both

@amaury1093 amaury1093 marked this pull request as ready for review October 29, 2020 14:37
Copy link
Contributor

@alessio alessio left a comment

Choose a reason for hiding this comment

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

ACK

@codecov
Copy link

codecov bot commented Oct 29, 2020

Codecov Report

Merging #7730 into master will increase coverage by 0.03%.
The diff coverage is 56.25%.

@@            Coverage Diff             @@
##           master    #7730      +/-   ##
==========================================
+ Coverage   54.31%   54.34%   +0.03%     
==========================================
  Files         610      610              
  Lines       38621    38627       +6     
==========================================
+ Hits        20976    20992      +16     
+ Misses      15508    15492      -16     
- Partials     2137     2143       +6     

x/auth/client/rest/decode.go Show resolved Hide resolved
@clevinson clevinson mentioned this pull request Oct 31, 2020
9 tasks
@amaury1093 amaury1093 added the A:automerge Automatically merge PR once all prerequisites pass. label Nov 2, 2020
@mergify mergify bot merged commit 194d2aa into master Nov 2, 2020
@mergify mergify bot deleted the am-7721-amino-height branch November 2, 2020 11:52
@aaronc aaronc removed the backlog label Nov 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A:automerge Automatically merge PR once all prerequisites pass.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Legacy amino tx queries by height fail.
6 participants