Skip to content

Crash when starting bor with a pruned ancient DB #1905

@vicmik

Description

@vicmik

When launching a bor 2.5.2 where the ancient db has previously been pruned it crashes on startup due to incorrect determination of the ancient offset.

INFO [11-20|11:36:23.074] Resolving ancient pruner offset isLastOffset=false offset=70,502,537
INFO [11-20|11:36:23.509] Opened ancient database database=/sata/bor/ancient/chain readonly=false frozen=4,089,552 offset=0
INFO [11-20|11:36:23.509] Opened Era store datadir=/sata/bor/ancient/chain/era
Chain metadata
databaseVersion: 9 (0x9)
headBlockHash: 0xa3e4465d58ac67247f76b0f9f4ca012ccb3b8fc4b4d16eabdd7b037b8667b178
headFastBlockHash: 0xa3e4465d58ac67247f76b0f9f4ca012ccb3b8fc4b4d16eabdd7b037b8667b178
headHeaderHash: 0xa3e4465d58ac67247f76b0f9f4ca012ccb3b8fc4b4d16eabdd7b037b8667b178
lastPivotNumber: 76289083 (0x48c143b)
len(snapshotSyncStatus): 282 bytes
snapshotDisabled: false
snapshotJournal: 6450900 bytes
snapshotRecoveryNumber: 77401896 (0x49d0f28)
snapshotRoot: 0x561b29c2264854edf0dee470164f698c6d563dfb447aa53e1e2c5f9297e5b72f
txIndexTail: 76914934 (0x495a0f6)
filterMapsRange: {Version:2 HeadIndexed:true HeadDelimiter:0 BlocksFirst:0 BlocksAfterLast:1 MapsFirst:0 MapsAfterLast:1 TailPartialEpoch:0}
missing parent hash for block #74592088 in ancient

I have verified that the same DB loads without error in bor 2.3.0.

This bug was introduced in bor 2.3.4 and is present in all later versions (including bor 2.5.2). The bug was introduced due to a human error when performing the upstream geth merge in PR #1694. Specifically, two lines of code that apply the ancient DB offset to the Freezer class were accidentally dropped in the NewFreezer() method in core/rawdb/freezer.go. Note that dropping those lines results in the "offset" parameter being unused, which should have been spotted by the linter.

I have locally fixed the error by re-introducing these two lines. I have verified that everything works as intended but have not run any tests from the test suite. Please fix this issue before the HF.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions