Skip to content

Enforce maxTotalReorgs in the consensus reorg check#213

Open
damilolaedwards wants to merge 1 commit into
ethpandaops:masterfrom
damilolaedwards:fix-reorgs-max-total-reorgs
Open

Enforce maxTotalReorgs in the consensus reorg check#213
damilolaedwards wants to merge 1 commit into
ethpandaops:masterfrom
damilolaedwards:fix-reorgs-max-total-reorgs

Conversation

@damilolaedwards

Copy link
Copy Markdown

Problem

check_consensus_reorgs documents a maxTotalReorgs option to bound the total number of reorgs observed during monitoring, but the field was never read. runCheck only enforced minCheckEpochCount and maxReorgsPerEpoch (and maxReorgDistance is handled separately). A playbook that set maxTotalReorgs to gate on total reorgs therefore had no effect: the check reported success no matter how many reorgs accumulated.

Fix

Evaluate maxTotalReorgs alongside the other reorg thresholds, and extract the threshold evaluation into a helper so it can be unit tested without the wall clock service.

Tests

Table test over the new bound (under, at, over, and unset), plus a guard for the neighbouring thresholds so the added check does not shadow them.

go build ./..., go vet, and the package tests pass.

The maxTotalReorgs option was declared and documented but never read, so a
playbook that set it to bound the total number of reorgs had no effect and
the check passed no matter how many reorgs accumulated. Evaluate it
alongside the other reorg thresholds, and extract the threshold logic into
a helper so it can be tested without the wall clock service.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant