-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Simplify BlockStore
#19880
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
Simplify BlockStore
#19880
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR simplifies the BlockStore
interface by adding helper methods and improving error handling, making the code more maintainable and consistent. The changes eliminate direct access to internal database wrapper methods and provide cleaner abstractions.
- Adds
transaction()
andget_block_from_cache()
helper methods toBlockStore
- Replaces database version checks with exception-based error handling using
UnsupportedDatabaseVersionError
- Improves batch processing in
get_block_records_by_hash()
to respect database parameter limits
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
chia/full_node/block_store.py | Adds helper methods and exception-based error handling for database operations |
chia/simulator/full_node_simulator.py | Uses new transaction() helper method instead of direct database wrapper access |
chia/full_node/full_node_api.py | Replaces version check with exception handling for unsupported database operations |
chia/consensus/blockchain.py | Uses new helper methods and removes manual batch processing logic |
chia/_tests/blockchain/test_blockchain.py | Updates test to use simplified API without batch_size parameter |
chia/_tests/blockchain/blockchain_test_utils.py | Uses new transaction() helper method |
Comments suppressed due to low confidence (1)
0bb7113
to
bda9f37
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice.
test coverage:
|
the one line missed by test coverage is the small change you made:
This used to be an assert, which suggests that this is checked earlier already |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we get_block_records_at for weight proof creation to get all sub epoch summary blocks, the current number of ses blocks should be something like 19283 so this would break when creating weight proofs on mainnet
Co-authored-by: Arvid Norberg <[email protected]>
aec98d0
Purpose:
Current Behavior:
New Behavior:
Testing Notes: