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(indexes): Fix wrong order in MemoryTxGroupIndex #977

Merged
1 commit merged into from
Mar 15, 2024

Conversation

msbrogli
Copy link
Member

@msbrogli msbrogli commented Mar 14, 2024

Motivation

MemoryTxGroupIndex._get_sorted_from_key() is returning transactions in the wrong order. The correct order is sorted by (timestamp, hash) but it is actually only sorting by hash.

Acceptance Criteria

  1. Replace set[bytes] to set[tuple[int, bytes]] so we can simply sort before returning the results.
  2. Fix _get_sorted_from_key() sorting the tuple but returning only the hashes.

Checklist

  • If you are requesting a merge into master, confirm this code is production-ready and can be included in future releases as soon as it gets merged

@msbrogli msbrogli requested a review from jansegre as a code owner March 14, 2024 20:52
@msbrogli msbrogli requested a review from pedroferreira1 March 14, 2024 20:52
@msbrogli msbrogli self-assigned this Mar 14, 2024
@msbrogli msbrogli added the bug Something isn't working label Mar 14, 2024
@msbrogli msbrogli force-pushed the fix/memory-tx-group-index-wrong-order branch 4 times, most recently from 9319b85 to 8aa43a7 Compare March 14, 2024 21:07
Copy link

codecov bot commented Mar 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.15%. Comparing base (4ccc883) to head (8aa43a7).

❗ Current head 8aa43a7 differs from pull request most recent head d3511d4. Consider uploading reports for the commit d3511d4 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #977      +/-   ##
==========================================
+ Coverage   85.13%   85.15%   +0.02%     
==========================================
  Files         294      294              
  Lines       22781    22782       +1     
  Branches     3426     3428       +2     
==========================================
+ Hits        19395    19401       +6     
+ Misses       2706     2701       -5     
  Partials      680      680              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@msbrogli msbrogli requested a review from glevco March 14, 2024 21:31
pedroferreira1
pedroferreira1 previously approved these changes Mar 15, 2024
hathor/indexes/memory_tx_group_index.py Outdated Show resolved Hide resolved
glevco
glevco previously approved these changes Mar 15, 2024
@msbrogli msbrogli dismissed stale reviews from glevco and pedroferreira1 via d3511d4 March 15, 2024 20:41
@msbrogli msbrogli force-pushed the fix/memory-tx-group-index-wrong-order branch from d3511d4 to a2ee438 Compare March 15, 2024 20:41
@msbrogli msbrogli closed this pull request by merging all changes into master in a2ee438 Mar 15, 2024
@msbrogli msbrogli deleted the fix/memory-tx-group-index-wrong-order branch March 15, 2024 20:42
@jansegre jansegre mentioned this pull request Apr 5, 2024
2 tasks
@jansegre jansegre mentioned this pull request May 8, 2024
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants