Skip to content

sc-consensus-beefy: fix initialization when state is unavailable#1888

Merged
acatangiu merged 1 commit into
paritytech:masterfrom
acatangiu:beefy-fix-sync-fast
Oct 16, 2023
Merged

sc-consensus-beefy: fix initialization when state is unavailable#1888
acatangiu merged 1 commit into
paritytech:masterfrom
acatangiu:beefy-fix-sync-fast

Conversation

@acatangiu

Copy link
Copy Markdown
Contributor

Fix situation where BEEFY initial validator set could not be determined.

If state is unavailable at BEEFY genesis block to get initial validator set, get the info from header digests. For this, we need to walk back the chain starting from BEEFY genesis looking for the BEEFY digest announcing the active validator set for that respective session.

This commit fixes a silly bug where walking back the chain was stopped when reaching BEEFY genesis block, which is incorrect when BEEFY genesis is not session boundary block. When BEEFY genesis is set to some random block within a session, we need to walk back to the start of the session to see the validator set announcement.

Added regression test for this fix.

Fixes #1885

Fix situation where BEEFY initial validator set could not be determined.

If state is unavailable at BEEFY genesis block to get initial validator
set, get the info from header digests. For this, we need to walk back the
chain starting from BEEFY genesis looking for the BEEFY digest announcing
the active validator set for that respective session.

This commit fixes a silly bug where walking back the chain was stopped
when reaching BEEFY genesis block, which is incorrect when BEEFY genesis
is not session boundary block. When BEEFY genesis is set to some random
block within a session, we need to walk back to the start of the session
to see the validator set announcement.

Added regression test for this fix.

Fixes paritytech#1885
@acatangiu acatangiu added the T0-node This PR/Issue is related to the topic “node”. label Oct 16, 2023
@acatangiu acatangiu self-assigned this Oct 16, 2023
@acatangiu acatangiu merged commit 646ecd0 into paritytech:master Oct 16, 2023
@acatangiu acatangiu deleted the beefy-fix-sync-fast branch October 16, 2023 14:35
tdimitrov pushed a commit that referenced this pull request Oct 23, 2023
Fix situation where BEEFY initial validator set could not be determined.

If state is unavailable at BEEFY genesis block to get initial validator
set, get the info from header digests. For this, we need to walk back
the chain starting from BEEFY genesis looking for the BEEFY digest
announcing the active validator set for that respective session.

This commit fixes a silly bug where walking back the chain was stopped
when reaching BEEFY genesis block, which is incorrect when BEEFY genesis
is not session boundary block. When BEEFY genesis is set to some random
block within a session, we need to walk back to the start of the session
to see the validator set announcement.

Added regression test for this fix.

Fixes #1885

Signed-off-by: Adrian Catangiu <adrian@parity.io>
bgallois pushed a commit to duniter/duniter-polkadot-sdk that referenced this pull request Mar 25, 2024
…itytech#1888)

Fix situation where BEEFY initial validator set could not be determined.

If state is unavailable at BEEFY genesis block to get initial validator
set, get the info from header digests. For this, we need to walk back
the chain starting from BEEFY genesis looking for the BEEFY digest
announcing the active validator set for that respective session.

This commit fixes a silly bug where walking back the chain was stopped
when reaching BEEFY genesis block, which is incorrect when BEEFY genesis
is not session boundary block. When BEEFY genesis is set to some random
block within a session, we need to walk back to the start of the session
to see the validator set announcement.

Added regression test for this fix.

Fixes paritytech#1885

Signed-off-by: Adrian Catangiu <adrian@parity.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T0-node This PR/Issue is related to the topic “node”.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rococo node crashes on --sync fast when starting with empty DB

4 participants