test: fix flaky TestLedgerBlockHeaders UpgradeState check#6382
Merged
gmalouf merged 1 commit intoalgorand:masterfrom Jul 15, 2025
Merged
test: fix flaky TestLedgerBlockHeaders UpgradeState check#6382gmalouf merged 1 commit intoalgorand:masterfrom
gmalouf merged 1 commit intoalgorand:masterfrom
Conversation
algorandskiy
approved these changes
Jul 15, 2025
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #6382 +/- ##
==========================================
- Coverage 50.60% 50.44% -0.16%
==========================================
Files 660 653 -7
Lines 110483 110415 -68
==========================================
- Hits 55913 55702 -211
- Misses 51713 51855 +142
- Partials 2857 2858 +1 ☔ View full report in Codecov by Sentry. |
gmalouf
approved these changes
Jul 15, 2025
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a flaky test TestLedgerBlockHeaders that was intermittently failing with "block branch512 incorrect" instead of the expected "UpgradeState mismatch" error. The issue occurred due to non-deterministic consensus version selection and insufficient handling of SHA512 field mismatches between protocol versions.
- Adds explicit handling for both SHA512 support mismatch scenarios
- Ensures the Branch512 field is correctly set to match the wrong version's expectations
- Prevents premature validation failure on Branch512 before reaching the intended UpgradeState check
This was referenced Jul 31, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TestLedgerBlockHeaders was failing intermittently with "block branch512 incorrect" instead of the expected "UpgradeState mismatch" error. This happened because:
The fix explicitly handles both mismatch cases to ensure the test reaches the intended validation error.
Test Plan
Ran with go test -run TestLedgerBlockHeaders -count=100 to reproduce and fix.