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: uniq by hash, instead of transaction #2062

Merged
merged 2 commits into from
May 30, 2019

Conversation

zachdaniel
Copy link
Contributor

@zachdaniel zachdaniel commented May 29, 2019

#883

Bug Fixes

  • when deduplicating transactions, don't compare the entire object, because preloaded associations could have the list objects in a different order. Instead, deduplicate them using their hash.

    • I added an entry to CHANGELOG.md with this PR
    • If I added new functionality, I added tests covering it.
    • If I fixed a bug, I added a regression test to prevent the bug from silently reappearing again.
    • I checked whether I should update the docs and did so if necessary

I tried really hard to reproduce this in a test, but the problem is that it is an inconsistent behavior. Postgres chooses the order of the returned rows. I could sort them to ensure that they always come back in the same order, but that is not actually a requirement of the UI, so we would be slowing it down just to be able to test it. I don't mind adding the sort for the sake of the test, just let me know.

I'm pretty positive that this is the problem but I haven't been able to find a local occurrence of this myself so we should test it against the sokol instance that had the original issue reported.

@zachdaniel zachdaniel force-pushed the remove-duplicate-token-transfers branch from 660b913 to 5edf4b4 Compare May 29, 2019 18:15
@coveralls
Copy link

coveralls commented May 29, 2019

Pull Request Test Coverage Report for Build aa3b38e8-c50b-40de-bc14-3244901e8888

  • 3 of 3 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.08%) to 80.736%

Totals Coverage Status
Change from base Build 4b0db646-9c20-419c-a36d-e4c817d84cb7: 0.08%
Covered Lines: 4807
Relevant Lines: 5954

💛 - Coveralls

[address_bytes, block_number, page_size]
)
defp transaction_hashes_from_token_transfers_sql(address_bytes, %PagingOptions{page_size: page_size} = paging_options) do
query =
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This doesn't need to be changed, but while debugging this issue I cleaned up this query. Might as well use the new more legible version. I will remove this change on request.

@zachdaniel zachdaniel force-pushed the remove-duplicate-token-transfers branch from c7be577 to 77e8f45 Compare May 29, 2019 18:49
@vbaranov
Copy link
Member

I'm pretty positive that this is the problem but I haven't been able to find a local occurrence of this myself so we should test it against the sokol instance that had the original issue reported.

I can reproduce this issue in stg. I will test this fix with the new wave of updates to stg.

@vbaranov
Copy link
Member

I can reproduce this issue in stg. I will test this fix with the new wave of updates to stg.

I hurried with this statement. I didn't find an example on stg. I will see this fix live on Sokol.

@vbaranov vbaranov merged commit 00c9cf0 into master May 30, 2019
@vbaranov vbaranov deleted the remove-duplicate-token-transfers branch May 30, 2019 18:27
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.

None yet

5 participants