forked from algorand/indexer
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Implement GET /v2/blocks
#10
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add `updates` and `participation` parameters to the endpoint `GET /v2/blocks`.
Write better descriptions for query parameters in `GET /v2/blocks`
agodnic
added a commit
to agodnic/indexer
that referenced
this pull request
Nov 17, 2024
Currently using the exact same implementation as AlgoNode#10
gmalouf
pushed a commit
to algorand/indexer
that referenced
this pull request
Dec 20, 2024
* Implement `GET /v2/blocks` Currently using the exact same implementation as AlgoNode#10 * Rename function * Rename function * Fix compiler error * Revert f17423b * Update file generated by mockery * Fix typo * Improve parameter descriptions * Change route to `GET /v2/block-headers` * Remove the `updates` and `participation` params Remove the `updates` and `participation` parameters from `GET /v2/block-headers`. The underlying SQL code is now simpler. * Lints * Rename struct * Fix outdated comment * Use faster/simpler sorting function * Use a more descriptive name for func `rowToBlock` * Remove decodeAddress / decodeAddressToBytes Remove the functions `decodeAddress` and `decodeAddressToBytes`. Also, add more context information to the errors being returned. * Attempt at fixing broken test Attempt at fixing `TestTimeouts/LookupAccountTransactions` * Change function `hdrRowToBlock` signature Change function `hdrRowToBlock` signature to be in line with other similar functions. * Rename `proposer` parameter to `proposers` In `GET /v2/block-headers`, rename the `proposer` parameter to `proposers` to follow conventions through the rest of the API.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This pull request implements the endpoint
GET /v2/blocks
, as specified in #9New indexes
The following new indexes are needed:
Performance
The new queries were tested in the FNet environment, which doesn't have the same data (i.e.: statistic distribution and overall quantity) as the mainnet environment. Performance discrepancies could arise from this.
Filter blocks by timestamp
curl -Ss 'http://127.0.0.1:8980/v2/blocks?limit=2&after-time=2024-10-01T00:00:00Z'
The execution pipeline consists of two nested index scans:
Search by multiple proposers
curl -Ss 'http://127.0.0.1:8980/v2/blocks?proposer=FNET43EQJGPZNQPDWZSWEPAGTVFBA5WKUB64BPWWWLD4MCJUCMQDSONATA,FNETXNAQWEQNSGCURWYEDBSRI2OE5AC2CDU2GBPYIB6CZ44PSYMCOUNTRY&min-round=140000'
The execution plan pipeline results in multiple concurrent index scans, one for each address provided:
Search by multiple expired accounts
curl -Ss 'http://127.0.0.1:8980/v2/blocks?expired=AM4RY6O7J3SNPFKFORCJPYGZNFSZCG4UNZQRT3NTHLQGGK5PAVM2ULLQPQ,BPYQOZ6RVKIUMQWABGBLMWBYV5IZDGCVVJ6QO4WOL2XG2X7YBFYMQUFB2Q&max-round=300000'
The execution plan pipeline results in an index scan. Then, the output is sorted by ascending round:
Provide multiple accounts in the `participation` parameter
curl -Ss 'http://127.0.0.1:8980/v2/blocks?participation=FNET43EQJGPZNQPDWZSWEPAGTVFBA5WKUB64BPWWWLD4MCJUCMQDSONATA,AM4RY6O7J3SNPFKFORCJPYGZNFSZCG4UNZQRT3NTHLQGGK5PAVM2ULLQPQ&min-round=200000'
The execution plan pipeline results in multiple index scans, streaming into a UNION operation. Then, the output is sorted by ascending round:
Limitations
Currently, participation filters can't be combined (i.e.: can only use one of
proposer
,expired
,absent
,updates
,participation
) because that led to poor execution plans. Could look into it if this is a problem.