This PR fixes the problem of mismatching block hashes due to the missing header fields difficulty and extraData in DA. It should be reviewed in conjunction with https://github.com/scroll-tech/go-ethereum/pull/903, which provides a way to prepare this missing data and describes the format in more detail.
Specifically, this PR implements a missing header fields manager that:
lazily downloads the missing header data if not present
verifies SHA256 checksum of the missing header fields data with hardcoded checksum that is part of the chain config
provides functionality to read the missing header fields when syncing from DA
Tested on mainnet:
inserted block with hash 0xd229dc5edaebccff15987f42bb5c23060b3f0372251e19e843f1bb69742bfab1 blockchain height=64500
1. Purpose or design rationale of this PR
This PR fixes the problem of mismatching block hashes due to the missing header fields
difficulty
andextraData
in DA. It should be reviewed in conjunction with https://github.com/scroll-tech/go-ethereum/pull/903, which provides a way to prepare this missing data and describes the format in more detail.Specifically, this PR implements a missing header fields manager that:
Tested on mainnet:
https://scrollscan.com/block/64500:
0xd229dc5edaebccff15987f42bb5c23060b3f0372251e19e843f1bb69742bfab1
2. PR title
Your PR title must follow conventional commits (as we are doing squash merge for each PR), so it must start with one of the following types:
3. Deployment tag versioning
Has the version in
params/version.go
been updated?4. Breaking change label
Does this PR have the
breaking-change
label?