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

fix!: limit will now decrease when subquery has no elements #277

Merged
merged 2 commits into from
Feb 22, 2024

Conversation

QuantumExplorer
Copy link
Member

Issue being fixed or feature implemented

When Querying Grovedb using subqueries and with a limit the limit would only decrease if the subquery actually had an item. However in most cases the limit is there to protect against very expensive queries.

The queries would be expensive because we could go through many many trees where the sub elements have no matches, hence the limit would not decrease and hence we would continue on the increasingly expensive query.

What was done?

Created an option to allow to decrease the limit by one per iteration if subqueries have no items on them.

How Has This Been Tested?

Updated tests and debugged to make sure it was working

Breaking Changes

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

@codecov
Copy link

codecov bot commented Oct 29, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

❗ No coverage uploaded for pull request base (develop@206bc63). Click here to learn what that means.

❗ Current head c353efe differs from pull request most recent head b40dd1a. Consider uploading reports for the commit b40dd1a to get more accurate results

Additional details and impacted files
@@           Coverage Diff            @@
##             develop   #277   +/-   ##
========================================
  Coverage           ?      0           
========================================
  Files              ?      0           
  Lines              ?      0           
  Branches           ?      0           
========================================
  Hits               ?      0           
  Misses             ?      0           
  Partials           ?      0           

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

@QuantumExplorer
Copy link
Member Author

This is being used in production for a while now, however it is not being used by proofs for now (as far as I am aware). I am merging this PR in for now, however more attention needs to taken to make sure such attacks can not happen on proofs.

@QuantumExplorer QuantumExplorer merged commit d007bed into develop Feb 22, 2024
7 checks passed
@QuantumExplorer QuantumExplorer deleted the fix/NoLimitDecreaseForSubqueries branch February 22, 2024 11:34
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