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

(BIDS-2663) Add sorting to postgres query using pagination #2685

Merged
merged 1 commit into from
Nov 14, 2023

Conversation

D13ce
Copy link
Contributor

@D13ce D13ce commented Nov 10, 2023

This PR adds sorting to the api1/validator/withdrawalCredentials/{withdrawalCredentialsOrEth1address} API endpoint to ensure correct pagination.

This should fix #2681.

Copy link
Collaborator

@Eisei24 Eisei24 left a comment

Choose a reason for hiding this comment

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

utACK
I could not find withdrawal credentials where the API returned the wrong amount of validators on any network. Adding an ORDER BY would also not make a difference.

But if I interpret the bug as

  • Make an API call with ?limit=200&offset=0 => Get 200 validator results
  • Make an API call with ?limit=200&offset=200 => Get 200 validator results
  • There are only ~390 different validators because they appear in both API calls

then the changes makes sense and should fix the issue.

@D13ce
Copy link
Contributor Author

D13ce commented Nov 14, 2023

utACK I could not find withdrawal credentials where the API returned the wrong amount of validators on any network. Adding an ORDER BY would also not make a difference.

But if I interpret the bug as

* Make an API call with `?limit=200&offset=0` => Get 200 validator results

* Make an API call with `?limit=200&offset=200` => Get 200 validator results

* There are only ~390 different validators because they appear in both API calls

then the changes makes sense and should fix the issue.

I have written a small test program that iterates over 50k validators based on a single withdrawal credential. Without ordering, I have missed some every run. With ordering I received all 50k validators every run.

@D13ce D13ce merged commit 62e11a3 into master Nov 14, 2023
@D13ce D13ce deleted the BIDS-2663/ValidatorWithdrawalsSorting branch November 14, 2023 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants