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 way to get coin states in batches #17300

Merged
merged 17 commits into from
Jan 23, 2024
Merged

Add way to get coin states in batches #17300

merged 17 commits into from
Jan 23, 2024

Conversation

Rigidity
Copy link
Contributor

@Rigidity Rigidity commented Jan 11, 2024

Purpose:

When added to the wallet protocol, this will allow wallets to sync their coin state efficiently in batches rather than downloading all of the state in a single response (which can fail if it's too large).

Testing Notes:

There is a unit test for ensuring that it successfully fetches the correct number of coins with a high volume of puzzle hashes (including with filters enabled and disabled), and another for high coin record count.

@Rigidity Rigidity added full_node Added Required label for PR that categorizes merge commit message as "Added" for changelog labels Jan 11, 2024
@Rigidity Rigidity marked this pull request as ready for review January 16, 2024 14:56
@Rigidity Rigidity requested a review from a team as a code owner January 16, 2024 14:56
chia/full_node/coin_store.py Outdated Show resolved Hide resolved
chia/full_node/coin_store.py Outdated Show resolved Hide resolved
chia/full_node/coin_store.py Outdated Show resolved Hide resolved
chia/full_node/coin_store.py Outdated Show resolved Hide resolved
chia/full_node/coin_store.py Show resolved Hide resolved
tests/core/full_node/stores/test_coin_store.py Outdated Show resolved Hide resolved
tests/core/full_node/stores/test_coin_store.py Outdated Show resolved Hide resolved
Copy link

coveralls-official bot commented Jan 16, 2024

Pull Request Test Coverage Report for Build 7626699349

Warning: This coverage report may be inaccurate.

We've detected an issue with your CI configuration that might affect the accuracy of this pull request's coverage report.
To ensure accuracy in future PRs, please see these guidelines.
A quick fix for this PR: rebase it; your next report should be accurate.

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.07%) to 90.662%

Totals Coverage Status
Change from base Build 7574540476: 0.07%
Covered Lines: 94966
Relevant Lines: 104713

💛 - Coveralls

Copy link
Contributor

@arvidn arvidn left a comment

Choose a reason for hiding this comment

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

maybe it would make sense to generate the coins in height order instead, and compare them directly to what you get back from the coin store, without sorting the coin states by amount.

The main challenge would be the cut in the middle where you need to make another request batch

chia/full_node/coin_store.py Outdated Show resolved Hide resolved
tests/core/full_node/stores/test_coin_store.py Outdated Show resolved Hide resolved
tests/core/full_node/stores/test_coin_store.py Outdated Show resolved Hide resolved
chia/full_node/coin_store.py Outdated Show resolved Hide resolved
chia/full_node/coin_store.py Outdated Show resolved Hide resolved
tests/core/full_node/stores/test_coin_store.py Outdated Show resolved Hide resolved
tests/core/full_node/stores/test_coin_store.py Outdated Show resolved Hide resolved
tests/core/full_node/stores/test_coin_store.py Outdated Show resolved Hide resolved
@Rigidity Rigidity requested a review from arvidn January 18, 2024 17:28
@Rigidity Rigidity closed this Jan 18, 2024
@Rigidity Rigidity reopened this Jan 18, 2024
@emlowe
Copy link
Contributor

emlowe commented Jan 19, 2024

Would also be useful to look into why the tests don't exercise line 495 as the coverage diff reports

Copy link
Contributor

@arvidn arvidn left a comment

Choose a reason for hiding this comment

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

I think the fixture is an important change to make.
I'm also not convinced you test the include_hints case. The SQL query is quite complex, I'm not confident that I can tell that it's correct (until we have a solid test)

chia/full_node/coin_store.py Show resolved Hide resolved
tests/core/full_node/stores/test_coin_store.py Outdated Show resolved Hide resolved
tests/core/full_node/stores/test_coin_store.py Outdated Show resolved Hide resolved
tests/core/full_node/stores/test_coin_store.py Outdated Show resolved Hide resolved
tests/core/full_node/stores/test_coin_store.py Outdated Show resolved Hide resolved
tests/core/full_node/stores/test_coin_store.py Outdated Show resolved Hide resolved
@Rigidity Rigidity requested a review from arvidn January 19, 2024 14:56
arvidn
arvidn previously approved these changes Jan 21, 2024
Copy link
Contributor

@arvidn arvidn 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! Feel free to resolve my comments. Maybe we should let Earle have another pass before we land as well

chia/full_node/coin_store.py Show resolved Hide resolved
chia/full_node/coin_store.py Show resolved Hide resolved
@Starttoaster Starttoaster merged commit f742e4e into main Jan 23, 2024
265 checks passed
@Starttoaster Starttoaster deleted the batched-coin-states branch January 23, 2024 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Added Required label for PR that categorizes merge commit message as "Added" for changelog full_node
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants