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

Rollback Block During Processing #14554

Merged
merged 7 commits into from
Oct 28, 2024
Merged

Rollback Block During Processing #14554

merged 7 commits into from
Oct 28, 2024

Conversation

nisdas
Copy link
Member

@nisdas nisdas commented Oct 18, 2024

What type of PR is this?

Bug Fix

What does this PR do? Why is it needed?

In the event that there are issues during the processing of a block we rollback the block insertion so as to ensure that the node is not left in an inconsistent state. This will allow the node to be able to process the block quickly again via req/resp .

Which issues(s) does this PR fix?

N.A

Other notes for review

Acknowledgements

  • I have read CONTRIBUTING.md.
  • I have made an appropriate entry to CHANGELOG.md.
  • I have added a description to this PR with sufficient context for reviewers to understand this PR.

potuz
potuz previously approved these changes Oct 28, 2024
Copy link
Contributor

@potuz potuz left a comment

Choose a reason for hiding this comment

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

LGTM

@nisdas nisdas marked this pull request as ready for review October 28, 2024 10:09
@nisdas nisdas requested a review from a team as a code owner October 28, 2024 10:09
@@ -76,6 +76,7 @@ func (s *Service) postBlockProcess(cfg *postBlockProcessConfig) error {

err := s.cfg.ForkChoiceStore.InsertNode(ctx, cfg.postState, cfg.roblock)
if err != nil {
s.rollbackBlock(ctx, cfg.roblock.Root())
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we have a unit test triggering this?

potuz
potuz previously approved these changes Oct 28, 2024
@nisdas nisdas added the Ready For Review A pull request ready for code review label Oct 28, 2024
require.NoError(t, err)

// Rollback block insertion into db and caches.
require.ErrorContains(t, "invalid parent root", service.postBlockProcess(&postBlockProcessConfig{ctx, roblock, [32]byte{}, postState, false}))
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you check for "could not insert block" and "to fork choice store" instead?

Copy link
Contributor

@potuz potuz left a comment

Choose a reason for hiding this comment

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

TSM

@nisdas nisdas enabled auto-merge October 28, 2024 13:44
@nisdas nisdas added this pull request to the merge queue Oct 28, 2024
Merged via the queue into develop with commit 2fe8614 Oct 28, 2024
18 checks passed
@nisdas nisdas deleted the rollbackBlock branch October 28, 2024 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ready For Review A pull request ready for code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants