- 
                Notifications
    You must be signed in to change notification settings 
- Fork 412
          feat(chain)!: make CheckPoint data field optional
          #2024
        
          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
base: master
Are you sure you want to change the base?
Conversation
cf98f58    to
    eddadd4      
    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.
.
| Some recommended test scenarios: 
 With the above tests: 
 | 
e805152    to
    86968bb      
    Compare
  
    e1166b6    to
    46bd424      
    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.
cACK c24dd6a
It looking good code-wise, though we probably need further discussion on what's the best approach, as discussed by Evan and VM in discord.
ba55b7e    to
    a216494      
    Compare
  
    | /// | ||
| /// This panics if called with a genesis block that differs from that of `self`. | ||
| #[must_use] | ||
| pub fn insert(self, height: u32, data: D) -> Self { | 
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.
Insert now looks really complicated. Do you have any ideas to simplify it?
a216494    to
    ae040c2      
    Compare
  
    ae040c2    to
    460bc46      
    Compare
  
    | @LagginTimes please review the modifications I made to  This implementation builds upon and improves the original PR's approach to optional checkpoint data in several key ways: 
 | 
* Base tip must always have data. * Update should be able to introduce data to a placeholder checkpoint in the original chain. * Remove unnecessary logic.
Add comprehensive tests for CheckPoint::push error cases: - Push fails when height is not greater than current - Push fails when prev_blockhash conflicts with self - Push succeeds when prev_blockhash matches - Push creates placeholder for non-contiguous heights Include tests for CheckPoint::insert conflict handling: - Insert with conflicting prev_blockhash - Insert purges conflicting tail - Insert between conflicting checkpoints 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
460bc46    to
    e4ebed0      
    Compare
  
    Rework CheckPoint::insert to properly handle conflicts: - Split chain into base (below insert height) and tail (at/above) - Rebuild chain by pushing tail items back, handling conflicts - Displace checkpoints to placeholders when prev_blockhash conflicts - Purge orphaned checkpoints that can no longer connect to chain - Fix edge cases where placeholders weren't handled correctly Improve CheckPoint::push: - Remove trailing placeholder checkpoints before pushing - Maintain existing behavior of creating placeholders for gaps Documentation improvements: - Clarify displacement vs purging rules without complex if-else chains - Add concrete examples showing the behavior - Add inline comments explaining the complex rebuild logic Add comprehensive test coverage for displacement scenarios including inserting at new/existing heights with various conflict types.
b301866    to
    7ce4d91      
    Compare
  
    
Resolves #2021.
Description
This PR makes the
CheckPoint::datafield optional. Gaps inferred fromprev_blockhashare represented as placeholder checkpoints wheredataisNone. Subsequentinsert()s will providedatafor the placeholders when a matching block arrives.See: #2017 (comment)
Notes to the reviewers
WIP
Changelog notice
Checklists
All Submissions:
New Features:
Bugfixes: