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

Filter pending blocks as well as canonical #115

Merged
merged 2 commits into from
Mar 2, 2025

Conversation

45930
Copy link
Contributor

@45930 45930 commented Feb 28, 2025

This PR applies the block height filter to the pending blocks as well as canonical.

Currently, if a user filters for actions from blocks a to b, they will get those plus all actions that are in pending blocks, regardless of their block height.

We should filter the canonical and the pending chains so that users who make a specific request get only the data they asked for. In the default case, there is no difference since the last n blocks will aways included the pending chain.

OLD:
image

NEW:
image
image

@45930 45930 requested a review from boray February 28, 2025 18:18
Copy link
Member

@boray boray left a comment

Choose a reason for hiding this comment

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

LGTM!

Note: It looks like we don't have a changelog in this repository. Maybe we could start keeping one with this PR?

@45930
Copy link
Contributor Author

45930 commented Mar 2, 2025

Re: changelog, we never actually release new versions of this... staketab just grab the commit and run it from source. I think it's a good idea to tag versions and keep a changelog. We will have to keep ourselves honest.

@45930 45930 merged commit 0473534 into main Mar 2, 2025
4 checks passed
@45930 45930 deleted the 2025-02-filter-pending-blocks branch March 2, 2025 15:38
@45930
Copy link
Contributor Author

45930 commented Mar 2, 2025

Merging this now to solve a need for zknoid

45930 added a commit that referenced this pull request Mar 10, 2025
Follow on to #115 .....

This PR moves the query our of the recursive CTE and into the full chain
union query. The height referenced in the recursive CTE is not usable as
I was trying previously.

Example screenshots from the old code:

As you can see, it is possible to query the right event, but the height
filter is not the expected number.


![image](https://github.com/user-attachments/assets/6132de6f-79d9-4607-9a0c-9918ecc5bda7)


![image](https://github.com/user-attachments/assets/2689338b-d5c4-494f-8005-e7a84b08f9b2)

New code:

As you see, the specific query now selects the correct actions.


![image](https://github.com/user-attachments/assets/5b307d30-2b3e-42e7-af1f-917e6fed700b)
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.

2 participants