fix: deflake //rs/tests/consensus:cup_explorer_test#8992
Open
basvandijk wants to merge 1 commit intomasterfrom
Open
fix: deflake //rs/tests/consensus:cup_explorer_test#8992basvandijk wants to merge 1 commit intomasterfrom
basvandijk wants to merge 1 commit intomasterfrom
Conversation
The cup_explorer_test flakes because the initial CUP downloaded from an application subnet may be a genesis CUP with NiDkgTargetSubnet::Remote. The verify() function calls get_subnet_id() which returns an error for Remote target subnets, and the unwrap() causes a panic. This happens when the test runs before the app subnet has produced enough blocks to create a CUP with Local DKG target (typically needs 2+ DKG intervals from genesis). In failing runs, the CUP was at height 15 (first DKG interval), while passing runs had CUPs at height 75+. The fix has two parts: 1. Change verify() in ic_cup_explorer to return Result<SubnetStatus, String> instead of panicking on errors, making it possible to retry on transient failures including Remote DKG target CUPs and HTTP timeouts. 2. Wrap the initial explore() + verify() calls in the test with retry_with_msg! to wait until a CUP with Local DKG target is available, consistent with how the halted-state check is already retried.
Collaborator
Author
|
@dfinity/consensus this is outside my area of expertise so please review carefully! |
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.
The
//rs/tests/consensus:cup_explorer_testis slightly flaky:Failing in mostly similar ways:
Claude Opus 4.6 made the following Root Cause Analysis and accompanying fixes:
Root Cause
The
cup_explorer_testflakes because the initial CUP downloaded from an application subnet may be a genesis CUP withNiDkgTargetSubnet::Remote. Theverify()function callsget_subnet_id()which returns an error for Remote target subnets, and theunwrap()causes a panic.This happens when the test runs before the app subnet has produced enough blocks to create a CUP with Local DKG target (typically needs 2+ DKG intervals from genesis). In failing runs, the CUP was at height 15 (first DKG interval), while passing runs had CUPs at height 75+.
A secondary flaky failure mode is HTTP request timeouts when querying the NNS node during verification.
Fix
Change
verify()inic_cup_explorerto returnResult<SubnetStatus, String>instead of panicking on errors (Remote DKG target, integrity check failures, signature verification failures, registry queries). This makes it possible to retry on transient failures.Wrap the initial `explore() + verify()` calls in the test with `retry_with_msg!` to wait until a CUP with Local DKG target is available, consistent with how the halted-state check is already retried.
Generated following
.claude/skills/fix-flaky-tests/SKILL.md.