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

Rm finality blocks and refactor checkpoint_submitter to be resilient to edge cases #2836

Merged
merged 13 commits into from
Oct 24, 2023

Conversation

tkporter
Copy link
Collaborator

Description

  • Use finality_blocks instead of reorg_period in validator #532 wasn't actually fully closed out - finality_blocks was used still for indexing. Sadly testnet4 infra wasn't configuring finality blocks anymore, so we weren't indexing only finalized blocks. Moved fully to reorg_period
  • Refactored checkpoint_submitter in light of races revealed by the above ^ problem. It used to assume that message indexing and the latest_checkpoint() call would align with one another, and wasn't resilient to the tree already being past the correctness checkpoint. A couple situations were possible before that aren't now:
    a. Indexing is ahead of the latest_checkpoint() call, which will result in tree ingesting the new indexed messages and the tree being ahead of the correctness checkpoint :(
    b. It's possible for the tree() call that constructs the tree initially to be made against a block that's after the next latest_checkpoint() call, which would result in the tree being ahead of the correctness checkpoint from the very beginning :(

Drive-by changes

removed a function that wasn't being used anymore

Related issues

#532

Backward compatibility

Removes finality blocks entirely

Testing

Builds, e2e

@tkporter tkporter requested a review from daniel-savu as a code owner October 24, 2023 10:53
@codecov
Copy link

codecov bot commented Oct 24, 2023

Codecov Report

Merging #2836 (b862640) into v3 (3efaafb) will decrease coverage by 0.10%.
The diff coverage is n/a.

Additional details and impacted files
@@            Coverage Diff             @@
##               v3    #2836      +/-   ##
==========================================
- Coverage   62.53%   62.43%   -0.10%     
==========================================
  Files          99       99              
  Lines        1017     1017              
  Branches      106      106              
==========================================
- Hits          636      635       -1     
  Misses        344      344              
- Partials       37       38       +1     
Components Coverage Δ
core 50.00% <ø> (ø)
hooks 69.28% <ø> (ø)
isms 69.06% <ø> (-0.72%) ⬇️
token 55.44% <ø> (ø)
middlewares 73.17% <ø> (ø)

rust/agents/validator/src/submit.rs Outdated Show resolved Hide resolved
rust/agents/validator/src/submit.rs Outdated Show resolved Hide resolved
rust/agents/validator/src/submit.rs Show resolved Hide resolved
rust/agents/validator/src/submit.rs Show resolved Hide resolved
rust/agents/validator/src/submit.rs Outdated Show resolved Hide resolved
rust/agents/validator/src/submit.rs Outdated Show resolved Hide resolved
rust/agents/validator/src/submit.rs Outdated Show resolved Hide resolved
rust/agents/validator/src/submit.rs Outdated Show resolved Hide resolved
@tkporter tkporter enabled auto-merge (squash) October 24, 2023 12:38
@tkporter tkporter merged commit 88346bf into v3 Oct 24, 2023
17 of 19 checks passed
@tkporter tkporter deleted the trevor/rm-finality-blocks branch October 24, 2023 13:56
//
// tree.index() will panic if the tree is empty, so we use tree.count() instead
// and convert the correctness_checkpoint.index to a count by adding 1.
while correctness_checkpoint.index + 1 > tree.count() as u32 {
Copy link
Member

Choose a reason for hiding this comment

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

is there no tree.index()?

Copy link
Member

Choose a reason for hiding this comment

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

can you use tree_exceeds_checkpoint here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

See the comment above on tree.index(), it panics if the count is 0 so this is the unfortunate workaround

And I don't think so because tree_exceeds_checkpoint returns true if tree.index > checkpoint.index (so doing !tree_exceeds_checkpoint would be if tree.index <= checkpoint.index) and we want the condition here to be checkpoint.index > tree.index

Comment on lines +233 to +234
// small sleep before signing next checkpoint to avoid rate limiting
sleep(Duration::from_millis(100)).await;
Copy link
Member

Choose a reason for hiding this comment

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

did you encounter this? assume this is specific to KMS so might be nice not to have it here but not critical

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No I just copied this from the existing logic, figured this was from that weird KMS thing too so didn't want to change

tkporter added a commit that referenced this pull request Oct 24, 2023
### Description

Deploy to include #2836

### Drive-by changes

n/a

### Related issues
n/a

### Backward compatibility

yes

### Testing

deployed
@yorhodes yorhodes mentioned this pull request Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants