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

add api-logs-limit flag #777

Merged
merged 5 commits into from
Jun 25, 2024
Merged

add api-logs-limit flag #777

merged 5 commits into from
Jun 25, 2024

Conversation

libotony
Copy link
Member

Description

Add a flag to allow node runner to specify the logs limit for the logs filter API.

Fixes # (issue)

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also
list any relevant details for your test configuration

  • Test A
  • Test B

Test Configuration:

  • Go Version:
  • Hardware:
  • Docker Version:

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • New and existing E2E tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have not added any vulnerable dependencies to my code

@libotony libotony requested a review from a team as a code owner June 20, 2024 06:26
@darrenvechain
Copy link
Member

Should we return an API error if the user specify more than the limit? Because if the user requests 5000 and gets 1000, then it looks like there are no more results, and they will stop making paginated requests

Copy link
Member

@otherview otherview left a comment

Choose a reason for hiding this comment

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

Structure is solid, and the limit makes sense to happen at the api lvl.

Probably worth to have a unit test that ensures the filtering is returning the max number of results in the events_test.go and in the transfers_test.go. We're testing the NormalizeOptions but if for example that function gets left out for some reason the tests won't capture that the query becomes now unbounded ?

Also, perhaps update the api yml definition to account for the existence of the flag ?

@darrenvechain
Copy link
Member

@libotony I made a PR here to fix the E2E. We need to merge this to main and then put the commit SHA in the e2e GHA

https://github.com/vechain/thor-e2e-tests/pull/24/files

@codecov-commenter
Copy link

codecov-commenter commented Jun 24, 2024

Codecov Report

Attention: Patch coverage is 81.25000% with 6 lines in your changes missing coverage. Please review.

Project coverage is 62.51%. Comparing base (c23c19a) to head (3ffd6ee).
Report is 1 commits behind head on master.

Files Patch % Lines
cmd/thor/main.go 0.00% 4 Missing ⚠️
api/api.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #777      +/-   ##
==========================================
- Coverage   62.62%   62.51%   -0.11%     
==========================================
  Files         199      199              
  Lines       18118    18140      +22     
==========================================
- Hits        11346    11340       -6     
- Misses       5690     5718      +28     
  Partials     1082     1082              

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

otherview
otherview previously approved these changes Jun 25, 2024
@libotony libotony merged commit c28bd36 into vechain:master Jun 25, 2024
15 checks passed
@libotony libotony deleted the logs-limit-flag branch June 25, 2024 10:01
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.

5 participants