paritytech / substrate

Substrate: The platform for blockchain innovators
Apache License 2.0
8.39k stars 2.65k forks source link

sc-consensus-beefy: fix BEEFY fast sync #14752

Closed acatangiu closed 1 year ago

acatangiu commented 1 year ago

When BEEFY voter is initialized from scratch (no aux db persistent data present), it needs to find BEEFY genesis block and all subsequent Mandatory blocks and sync justifications for them.

The initialization code was getting active validator sets for these older blocks from state, but in cases such as 'fast sync', state is unavailable.

This commit adds a fallback initialization mechanism when state is unavailable: parse header Digests looking for validator set change log deposits.