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

[Access] Use local event for AccessAPI get events endpoints #4851

Merged
merged 18 commits into from
Dec 22, 2023

Conversation

peterargue
Copy link
Contributor

@peterargue peterargue commented Oct 20, 2023

Closes: #4751

Use locally indexed events for GetEvents* endpoints

@codecov-commenter
Copy link

codecov-commenter commented Oct 20, 2023

Codecov Report

Attention: 43 lines in your changes are missing coverage. Please review.

Comparison is base (6e8c3b7) 56.42% compared to head (f8dc637) 54.46%.
Report is 24 commits behind head on master.

Files Patch % Lines
engine/access/rpc/backend/backend_events.go 69.23% 21 Missing and 7 partials ⚠️
engine/access/rpc/backend/config.go 28.57% 10 Missing ⚠️
utils/unittest/fixtures.go 0.00% 2 Missing ⚠️
engine/access/rest/routes/test_helpers.go 87.50% 1 Missing ⚠️
engine/access/rpc/backend/backend_accounts.go 75.00% 1 Missing ⚠️
engine/access/rpc/backend/backend_scripts.go 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4851      +/-   ##
==========================================
- Coverage   56.42%   54.46%   -1.96%     
==========================================
  Files         981      815     -166     
  Lines       93053    75174   -17879     
==========================================
- Hits        52504    40943   -11561     
+ Misses      36662    31265    -5397     
+ Partials     3887     2966     -921     
Flag Coverage Δ
unittests 54.46% <70.94%> (-1.96%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@peterargue peterargue self-assigned this Oct 20, 2023
@peterargue peterargue marked this pull request as draft October 20, 2023 00:28
@peterargue peterargue marked this pull request as ready for review December 15, 2023 04:31
eventType string,
requiredEventEncodingVersion entities.EventEncodingVersion,
) ([]flow.BlockEvents, []*flow.Header, error) {
target := flow.EventType(eventType)
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to validate the event type?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the target is only used for effectively a string comparison, so it's pretty benign, but I can add it.


missing := make([]*flow.Header, 0)
resp := make([]flow.BlockEvents, 0)
for _, header := range blockHeaders {
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to restrict the number of blocks to query events from? Or the caller has checked that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the caller checks that

here

if rangeSize > uint64(b.maxHeightRange) {
return nil, status.Errorf(codes.InvalidArgument,
"requested block range (%d) exceeded maximum (%d)", rangeSize, b.maxHeightRange)
}

and here

if uint(len(blockIDs)) > b.maxHeightRange {
return nil, status.Errorf(codes.InvalidArgument, "requested block range (%d) exceeded maximum (%d)", len(blockIDs), b.maxHeightRange)
}

Copy link
Collaborator

@Guitarheroua Guitarheroua left a comment

Choose a reason for hiding this comment

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

Looks good for me

Co-authored-by: Leo Zhang <zhangchiqing@gmail.com>
@peterargue peterargue added this pull request to the merge queue Dec 22, 2023
Merged via the queue into master with commit a1b17ac Dec 22, 2023
51 checks passed
@peterargue peterargue deleted the petera/4751-use-local-events branch December 22, 2023 17:15
peterargue added a commit that referenced this pull request Jan 4, 2024
[Access] Use local event for AccessAPI get events endpoints
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.

[Access] Use local index for Events in Access API
4 participants