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

Fix/missing state root on start #6055

Merged
merged 2 commits into from
Aug 31, 2023
Merged

Conversation

asdacap
Copy link
Contributor

@asdacap asdacap commented Aug 30, 2023

Fixes #5996

  • Fix issue with missing state root on restart.
  • Sometimes when the block tree initialization code detected some unusual pattern, it will try to set the head to BestSuggestedHeader.
  • However, with memory pruning, BestSuggestedHeader may not have its state stored, causing a block processing error on restart.
  • This is fairly easy to reproduce by always triggering the fixer.
  • This changes that so that it will use BestPersistedState if available.
  • Also minor refactor to move block tree initialization code to another file.
2023-08-10 18:09:48.9876|DEBUG|19|Saving reorg boundary 9495427 

2023-08-10 18:10:24.6890|INFO|19|Processed             9495447     | 40,006.56 ms  |  slot     41,531 ms | Gas gwei: 0.14 .. 0.19 (2.69) .. 100.00 
2023-08-10 18:10:24.6890|INFO|19|- Block              12.87 MGas   |     68    txs |  calls  9,750 (143) | sload  35,982 | sstore  8,210 | create   7 
2023-08-10 18:10:24.6890|INFO|19|- Block throughput    0.32 MGas/s |      1.70 t/s |          0.00 Blk/s | recv        0 | proc       34 
2023-08-10 18:10:24.6890|DEBUG|19|- Total throughput    0.31 MGas/s |      1.64 t/s |          0.00 Blk/s | Gas gwei: 0.13 .. 0.15 (2.90) .. 100.00 
2023-08-10 18:11:16.8818|INFO|19|Processed     9495483...  9495484 |  4,800.23 ms  |  slot      8,779 ms | Gas gwei: 0.11 .. 0.11 (2.75) .. 100.00 
2023-08-10 18:11:16.8818|INFO|19|- Blocks 2           27.73 MGas   |    166    txs |  calls  1,119 ( 17) | sload   4,017 | sstore    932 | create   4 
2023-08-10 18:11:16.8818|INFO|19|- Block throughput    5.78 MGas/s |     34.58 t/s |          0.42 Blk/s | recv        0 | proc        0 
2023-08-10 18:11:16.8818|DEBUG|19|- Total throughput    6.10 MGas/s |     30.62 t/s |          0.41 Blk/s | Gas gwei: 0.10 .. 0.28 (2.85) .. 130.00 

2023-08-10 18:11:16.9907|DEBUG|61|Valid. Request: ForkChoice: Head: 9495484 (0xd51dc5...f1813f), Safe: 9495453 (0x97cf9c...9d1fca), Finalized: 9495425 (0xf3d257...a304bc). 

2023-08-10 18:11:22.2487|DEBUG|15|Executing step: InitializeBlockTree : InitializeBlockTree (WaitingForExecution) 
2023-08-10 18:11:22.3732|INFO|15|Start block loaded from reorg boundary - 9495427 - 9495427 (0x2611fc...ece740) 
2023-08-10 18:11:22.5170|INFO|15|Numbers resolved, level = Max(9495427, 9495484), header = Max(9495427, 9495484), body = Max(0, 9495484) 
2023-08-10 18:11:22.5780|INFO|15|Beacon Numbers resolved, level = 9495426, header = 0, body = 9495426 
2023-08-10 18:11:22.5780|WARN|15|Detected corrupted block tree data (0 < 9495426) (possibly due to an unexpected shutdown). Attempting to fix by moving head backwards. This may fail and you may need to resync the node. 
2023-08-10 18:11:22.5994|INFO|15|Block tree initialized, last processed is 9495484 (0xd51dc5...f1813f), best queued is 9495484, best known is 9495484, lowest inserted header 1, body 9469168, lowest sync inserted block number 9494583 

Changes

  • Make the fixes set head to best persisted state if available instead.

Types of changes

What types of changes does your code introduce?

  • Bugfix (a non-breaking change that fixes an issue)
  • Refactoring

Testing

Requires testing

  • Yes

If yes, did you write tests?

  • Yes

Notes on testing

  • Confirm reproducable by always triggering the fixer. Confirm no longer reproducable after the change.

@asdacap asdacap merged commit 3a02cdf into master Aug 31, 2023
61 checks passed
@asdacap asdacap deleted the fix/missing-state-root-on-start branch August 31, 2023 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants