blockstore: Parent must be full to set previous_blockhash#12012
Open
steviez wants to merge 2 commits intoanza-xyz:masterfrom
Open
blockstore: Parent must be full to set previous_blockhash#12012steviez wants to merge 2 commits intoanza-xyz:masterfrom
steviez wants to merge 2 commits intoanza-xyz:masterfrom
Conversation
steviez
commented
Apr 17, 2026
Comment on lines
-8528
to
-8529
| let parent_meta = SlotMeta::default(); | ||
| blockstore.put_meta(slot - 1, &parent_meta).unwrap(); |
Author
There was a problem hiding this comment.
A couple notes on this removal:
- Directly modifying the meta muddies the water on what insertion logic does
- Insertion logic inserts an empty slot meta for the empty
slot - 1as part of chaining so this is redundant / unnecessary - If this was modifying a meta for a non-empty slot, it'd be creating a column inconsistency that isn't reachable with normal logic
Comment on lines
+8561
to
+8569
| // A full root will return an error if the previous blockhash is | ||
| // required and the parent slot is partially full | ||
| /* | ||
| // Uncomment me in next commit - this assert will fail currently | ||
| assert_matches!( | ||
| blockstore.get_rooted_block(slot, true), | ||
| Err(BlockstoreError::ParentEntriesUnavailable) | ||
| ); | ||
| */ |
Author
There was a problem hiding this comment.
If reviewers want to verify, they can:
- Pull the branch down
- Revert the second commit
- Uncomment this assert out
- Run
cargo test test_get_rooted_blockto see this test fail - Pull down the tip of the branch again (to get both commits)
- Run
cargo test test_get_rooted_blockagain to see the test succeed since the second commit adjusts logic in the actual prod code
23db450 to
9600df3
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #12012 +/- ##
=======================================
Coverage 83.2% 83.2%
=======================================
Files 860 860
Lines 321570 321579 +9
=======================================
+ Hits 267774 267784 +10
+ Misses 53796 53795 -1 🚀 New features to boost your workflow:
|
AshwinSekar
approved these changes
Apr 17, 2026
cpubot
approved these changes
Apr 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
Blockstore:: do_get_complete_block_with_entries()method is in the call stack for an RPCgetBlockcall. One of the fields in the result is the blockhash of the parent block. The current logic grabs the last entry from the parent block and uses this. However, the parent block could be non-full which could result in an invalid value being set forprevious_blockhash.In normal operation, this is quite unlikely as rooting the current block implies that we'll have rooted the parent block. This bug was discovered debugging a devnet bigtable issue that stems from weirdness around deactivating features (see #7287 for more on that).
Summary of Changes
do_get_complete_block_with_entries()to ensure the previous blockhash is only populated when the parent is fullI plan on squashing commits prior to merge to clean up commit history + add details from above message into commit