Skip to content

Add worldstate heal mechanism #5059

Merged
macfarla merged 4 commits into
besu-eth:mainfrom
matkt:heal-bonsai
Feb 8, 2023
Merged

Add worldstate heal mechanism #5059
macfarla merged 4 commits into
besu-eth:mainfrom
matkt:heal-bonsai

Conversation

@matkt

@matkt matkt commented Feb 6, 2023

Copy link
Copy Markdown
Contributor

Signed-off-by: Karim TAAM karim.t2am@gmail.com

PR description

This PR add a heal mechanism fo the worldtstate in case of inconsistency (unable to trie node). To fix this, we start a quick heal of the worldstate automatically and once the fix is done we restart the block import.

After the detection of an invalid path

  • we delete this path to force the healing of this part.
  • then we delete the trielogs.
  • we select a pivot block (before of after the heal)
  • we move the blokchain to this pivot block (rewind or download the missing blocks)
  • then we launch a worldstate heal.

This feature can also heal a node that has been inconsistent for a long time, but it will take longer because there will be more nodes to heal. With this PR the healing will be done as soon as the problem is detected so there will not a lot to heal and it will be fast

Performed tests

  • Trigger multiple inconsistencies to fix (passed)
  • Fixed a node that has been inconsistent for a long time (passed)
  • Run a snapsync from scratch on goerli (passed)
  • Run a checkpoint sync from scratch on goelri (passed)
  • Run a checkpoint sync from scratch on main (in progress)
  • Run a validator teku+besu on goerli (passed)
  • Profile performance on this node to avoid perf regression (passed)

Fixed Issue(s)

#4379
#4785
#4768

Documentation

  • I thought about documentation and added the doc-change-required label to this PR if
    updates are required.

Changelog

Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
@matkt matkt requested review from garyschulte and siladu February 6, 2023 07:23
@matkt matkt mentioned this pull request Feb 6, 2023
2 tasks
@matkt matkt marked this pull request as ready for review February 6, 2023 07:25
@matkt

matkt commented Feb 6, 2023

Copy link
Copy Markdown
Contributor Author

Initial PR is here #4972

Comment on lines +47 to +49
return firstHeader ->
blockchain.contains(firstHeader.getParentHash())
&& blockchain.getChainHeadBlockNumber() + 1 >= firstHeader.getNumber();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

looks fine though, I will assume it's an extra safety check.

@siladu siladu Feb 7, 2023

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

...ah just caught up with the new comments from the old PR :)
#4972 (comment)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's fine . It's a fix

@siladu siladu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks like be an accurate recreation of #4972 except for the minor change I mentioned in the comment

@siladu siladu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM as someone with not much in-depth bonsai knowledge. Ideally someone else with more experience in this area will approve :)

@macfarla macfarla left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM (but I am also no bonsai expert)
Needs a changelog entry

@macfarla macfarla left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@macfarla macfarla enabled auto-merge (squash) February 8, 2023 02:21
@macfarla macfarla merged commit 77b55ed into besu-eth:main Feb 8, 2023
ensi321 pushed a commit to ensi321/besu that referenced this pull request Feb 19, 2023
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
Co-authored-by: Simon Dudley <simon.dudley@consensys.net>
Co-authored-by: Sally MacFarlane <macfarla.github@gmail.com>
elenduuche pushed a commit to elenduuche/besu that referenced this pull request Aug 16, 2023
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
Co-authored-by: Simon Dudley <simon.dudley@consensys.net>
Co-authored-by: Sally MacFarlane <macfarla.github@gmail.com>
@matkt matkt deleted the heal-bonsai branch September 22, 2023 09:37
eum602 pushed a commit to lacchain/besu that referenced this pull request Nov 3, 2023
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
Co-authored-by: Simon Dudley <simon.dudley@consensys.net>
Co-authored-by: Sally MacFarlane <macfarla.github@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants